Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"require-dev": {
"boundwize/structarmed": "0.13.4",
"codeigniter/phpstan-codeigniter": "^1.5",
"codeigniter/phpstan-codeigniter": "^2.1",
"fakerphp/faker": "^1.24",
"kint-php/kint": "^6.1",
"mikey179/vfsstream": "^1.6.12",
Expand All @@ -29,7 +29,7 @@
"phpunit/phpcov": "^9.0.2 || ^10.0",
"phpunit/phpunit": "^10.5.16 || ^11.2",
"predis/predis": "^3.0",
"rector/rector": "2.4.5",
"rector/rector": "2.4.6",
"shipmonk/phpstan-baseline-per-identifier": "^2.0"
},
"replace": {
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ parameters:
additionalModelNamespaces:
- Tests\Support\Models
checkArgumentTypeOfModel: false
schemaCacheDirectory: %currentWorkingDirectory%/build/phpstan
shipmonkBaselinePerIdentifier:
directory: %currentWorkingDirectory%
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@
__DIR__ . '/phpstan-bootstrap.php',
])
->withPHPStanConfigs([
__DIR__ . '/phpstan.neon.dist',
__DIR__ . '/vendor/codeigniter/phpstan-codeigniter/extension.neon',
__DIR__ . '/vendor/phpstan/phpstan-strict-rules/rules.neon',
__DIR__ . '/vendor/shipmonk/phpstan-baseline-per-identifier/extension.neon',
__DIR__ . '/phpstan.neon.dist',
])
// is there a file you need to skip?
->withSkip([
Expand Down
2 changes: 1 addition & 1 deletion system/Filters/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public function getRequiredFilters(string $position = 'before'): array
{
// For backward compatibility. For users who do not update Config\Filters.
if (! isset($this->config->required[$position])) {
$baseConfig = config(BaseFiltersConfig::class); // @phpstan-ignore-line
$baseConfig = config(BaseFiltersConfig::class);
$filters = $baseConfig->required[$position];
$aliases = $baseConfig->aliases;
} else {
Expand Down
8 changes: 4 additions & 4 deletions tests/system/CommonSingleServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function testSingleServiceWithNoParamsSupplied(string $service): void
{
Services::injectMock('security', new MockSecurity(new SecurityConfig()));

$service1 = single_service($service); // @phpstan-ignore codeigniter.unknownServiceMethod
$service2 = single_service($service); // @phpstan-ignore codeigniter.unknownServiceMethod
$service1 = single_service($service);
$service2 = single_service($service);

$this->assertNotNull($service1);

Expand All @@ -62,8 +62,8 @@ public function testSingleServiceWithAtLeastOneParamSupplied(string $service): v

$params[] = $method->getNumberOfParameters() === 1 ? true : $method->getParameters()[0]->getDefaultValue();

$service1 = single_service($service, ...$params); // @phpstan-ignore codeigniter.unknownServiceMethod
$service2 = single_service($service, ...$params); // @phpstan-ignore codeigniter.unknownServiceMethod
$service1 = single_service($service, ...$params);
$service2 = single_service($service, ...$params);

$this->assertNotNull($service1);

Expand Down
4 changes: 2 additions & 2 deletions tests/system/Config/DotEnvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static function provideLoadsVars(): iterable
public function testLoadsHex2Bin(): void
{
putenv('encryption.key');
unset($_ENV['encryption.key'], $_SERVER['encryption.key']); // @phpstan-ignore codeigniter.superglobalAccess
unset($_ENV['encryption.key'], $_SERVER['encryption.key']);

$dotenv = new DotEnv($this->fixturesFolder, 'encryption.env');
$dotenv->load();
Expand All @@ -108,7 +108,7 @@ public function testLoadsHex2Bin(): void
public function testLoadsBase64(): void
{
putenv('encryption.key');
unset($_ENV['encryption.key'], $_SERVER['encryption.key']); // @phpstan-ignore codeigniter.superglobalAccess
unset($_ENV['encryption.key'], $_SERVER['encryption.key']);

$dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env');
$dotenv->load();
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Entity/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ public function testCastEnumNullable(): void

$entity->status = null;

$this->assertNull($entity->status);
$this->assertNotInstanceOf(StatusEnum::class, $entity->status);

$entity->status = 'pending';

Expand Down Expand Up @@ -1573,7 +1573,7 @@ public function testDataCasterInitEmptyCasts(): void

$getDataCaster = $this->getPrivateMethodInvoker($entity, 'dataCaster');

$this->assertNull($getDataCaster());
$this->assertNotInstanceOf(DataCaster::class, $getDataCaster());
$this->assertNull($this->getPrivateProperty($entity, 'dataCaster'));
$this->assertSame('12345', $entity->first);

Expand Down
22 changes: 11 additions & 11 deletions tests/system/Models/DataConverterModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testFindAsArray(): void

$user = $this->model->find($id);

$this->assertIsInt($user['id']); // @phpstan-ignore offsetAccess.notFound
$this->assertIsInt($user['id']);
$this->assertInstanceOf(Time::class, $user['created_at']);
$this->assertSame('John Smith', $user['name']);
// `name` is cast by custom CastBase64 handler.
Expand Down Expand Up @@ -128,9 +128,9 @@ public function testFindAllAsArray(): void

$users = $this->model->findAll();

$this->assertIsInt($users[0]['id']); // @phpstan-ignore offsetAccess.notFound
$this->assertIsInt($users[0]['id']);
$this->assertInstanceOf(Time::class, $users[0]['created_at']);
$this->assertIsInt($users[1]['id']); // @phpstan-ignore offsetAccess.notFound
$this->assertIsInt($users[1]['id']);
$this->assertInstanceOf(Time::class, $users[1]['created_at']);
}

Expand Down Expand Up @@ -208,7 +208,7 @@ public function testFirstAsArray(): void

$user = $this->model->first();

$this->assertIsInt($user['id']); // @phpstan-ignore offsetAccess.notFound
$this->assertIsInt($user['id']);
$this->assertInstanceOf(Time::class, $user['created_at']);
}

Expand Down Expand Up @@ -265,7 +265,7 @@ public function testInsertArray(): void

$user = $this->model->find($id);

$this->assertSame(['joe@example.com'], $user['email']); // @phpstan-ignore offsetAccess.notFound
$this->assertSame(['joe@example.com'], $user['email']);
}

public function testInsertObject(): void
Expand All @@ -281,7 +281,7 @@ public function testInsertObject(): void

$user = $this->model->find($id);

$this->assertSame(['joe@example.com'], $user['email']); // @phpstan-ignore offsetAccess.notFound
$this->assertSame(['joe@example.com'], $user['email']);
}

public function testUpdateArray(): void
Expand All @@ -290,14 +290,14 @@ public function testUpdateArray(): void
$user = $this->model->find($id);

$user['email'][] = 'private@example.org';
$this->model->update($user['id'], $user); // @phpstan-ignore offsetAccess.notFound
$this->model->update($user['id'], $user);

$user = $this->model->find($id);

$this->assertSame([
'john@example.com',
'private@example.org',
], $user['email']); // @phpstan-ignore offsetAccess.notFound
], $user['email']);
}

public function testUpdateObject(): void
Expand All @@ -313,7 +313,7 @@ public function testUpdateObject(): void
$this->assertSame([
'john@example.com',
'private@example.org',
], $user['email']); // @phpstan-ignore offsetAccess.notFound
], $user['email']);
}

public function testUpdateCustomObject(): void
Expand Down Expand Up @@ -365,7 +365,7 @@ public function testSaveArray(): void
$this->assertSame([
'john@example.com',
'private@example.org',
], $user['email']); // @phpstan-ignore offsetAccess.notFound
], $user['email']);
}

public function testSaveObject(): void
Expand All @@ -381,7 +381,7 @@ public function testSaveObject(): void
$this->assertSame([
'john@example.com',
'private@example.org',
], $user['email']); // @phpstan-ignore offsetAccess.notFound
], $user['email']);
}

public function testSaveCustomObject(): void
Expand Down
16 changes: 8 additions & 8 deletions tests/system/Models/TimestampModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function testDoNotAllowDatesInsertArrayWithoutDatesSetsTimestamp(): void
$expected .= '.000';
}

$this->assertSame($expected, $user['created_at']); // @phpstan-ignore offsetAccess.notFound
$this->assertSame($expected, $user['created_at']);
$this->assertSame($expected, $user['updated_at']);
}

Expand All @@ -123,7 +123,7 @@ public function testDoNotAllowDatesInsertArrayWithDatesSetsTimestamp(): void
$expected .= '.000';
}

$this->assertSame($expected, $user['created_at']); // @phpstan-ignore offsetAccess.notFound
$this->assertSame($expected, $user['created_at']);
$this->assertSame($expected, $user['updated_at']);
}

Expand All @@ -143,7 +143,7 @@ public function testDoNotAllowDatesUpdateArrayUpdatesUpdatedAt(): void
$user = $this->model->find($id);

$user['country'] = 'CA';
$this->model->update($user['id'], $user); // @phpstan-ignore offsetAccess.notFound
$this->model->update($user['id'], $user);

$user = $this->model->find($id);

Expand All @@ -153,7 +153,7 @@ public function testDoNotAllowDatesUpdateArrayUpdatesUpdatedAt(): void
$expected .= '.000';
}

$this->assertSame($expected, $user['created_at']); // @phpstan-ignore offsetAccess.notFound
$this->assertSame($expected, $user['created_at']);
$this->assertSame($expected, $user['updated_at']);
}

Expand Down Expand Up @@ -208,7 +208,7 @@ public function testAllowDatesInsertArrayWithoutDatesSetsTimestamp(): void
$expected .= '.000';
}

$this->assertSame($expected, $user['created_at']); // @phpstan-ignore offsetAccess.notFound
$this->assertSame($expected, $user['created_at']);
$this->assertSame($expected, $user['updated_at']);
}

Expand Down Expand Up @@ -237,7 +237,7 @@ public function testAllowDatesInsertArrayWithDatesSetsTimestamp(): void
$expected .= '.000';
}

$this->assertSame($expected, $user['created_at']); // @phpstan-ignore offsetAccess.notFound
$this->assertSame($expected, $user['created_at']);
$this->assertSame($expected, $user['updated_at']);
}

Expand All @@ -261,7 +261,7 @@ public function testAllowDatesUpdateArrayUpdatesUpdatedAt(): void
$user = $this->model->find($id);

$user['country'] = 'CA';
$this->model->update($user['id'], $user); // @phpstan-ignore offsetAccess.notFound
$this->model->update($user['id'], $user);

$user = $this->model->find($id);

Expand All @@ -271,7 +271,7 @@ public function testAllowDatesUpdateArrayUpdatesUpdatedAt(): void
$expected .= '.000';
}

$this->assertSame($expected, $user['created_at']); // @phpstan-ignore offsetAccess.notFound
$this->assertSame($expected, $user['created_at']);
$this->assertSame($expected, $user['updated_at']);
}

Expand Down
12 changes: 1 addition & 11 deletions utils/phpstan-baseline/argument.type.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 78 errors
# total 76 errors

parameters:
ignoreErrors:
Expand Down Expand Up @@ -177,21 +177,11 @@ parameters:
count: 1
path: ../../tests/system/Log/Handlers/ChromeLoggerHandlerTest.php

-
message: '#^Parameter \#1 \$row of method CodeIgniter\\BaseModel\:\:save\(\) expects array\<int\|string, bool\|float\|int\|object\|string\|null\>\|object, array\<string, array\<int, string\>\> given\.$#'
count: 1
path: ../../tests/system/Models/DataConverterModelTest.php

-
message: '#^Parameter \#1 \$row of method CodeIgniter\\Model\:\:insert\(\) expects array\<int\|string, bool\|float\|int\|object\|string\|null\>\|object\|null, array\<string, list\<string\>\|string\> given\.$#'
count: 3
path: ../../tests/system/Models/DataConverterModelTest.php

-
message: '#^Parameter \#2 \$row of method CodeIgniter\\Model\:\:update\(\) expects array\<int\|string, bool\|float\|int\|object\|string\|null\>\|object\|null, array\<string, array\<int, string\>\> given\.$#'
count: 1
path: ../../tests/system/Models/DataConverterModelTest.php

-
message: '#^Parameter \#1 \$format of method CodeIgniter\\RESTful\\ResourceController\:\:setFormat\(\) expects ''json''\|''xml'', ''Nonsense'' given\.$#'
count: 1
Expand Down
18 changes: 0 additions & 18 deletions utils/phpstan-baseline/codeigniter.getReassignArray.neon

This file was deleted.

Loading
Loading