Skip to content

Commit 5dfbdb8

Browse files
authored
Merge branch 'develop' into fix/sodium-handler-encrypt-decrypt-bugs
2 parents 4c47247 + 18887b2 commit 5dfbdb8

22 files changed

Lines changed: 347 additions & 230 deletions

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"require-dev": {
2020
"boundwize/structarmed": "0.13.4",
21-
"codeigniter/phpstan-codeigniter": "^1.5",
21+
"codeigniter/phpstan-codeigniter": "^2.1",
2222
"fakerphp/faker": "^1.24",
2323
"kint-php/kint": "^6.1",
2424
"mikey179/vfsstream": "^1.6.12",
@@ -29,7 +29,7 @@
2929
"phpunit/phpcov": "^9.0.2 || ^10.0",
3030
"phpunit/phpunit": "^10.5.16 || ^11.2",
3131
"predis/predis": "^3.0",
32-
"rector/rector": "2.4.5",
32+
"rector/rector": "2.4.6",
3333
"shipmonk/phpstan-baseline-per-identifier": "^2.0"
3434
},
3535
"replace": {

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ parameters:
4747
additionalModelNamespaces:
4848
- Tests\Support\Models
4949
checkArgumentTypeOfModel: false
50+
schemaCacheDirectory: %currentWorkingDirectory%/build/phpstan
5051
shipmonkBaselinePerIdentifier:
5152
directory: %currentWorkingDirectory%

rector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@
7777
__DIR__ . '/phpstan-bootstrap.php',
7878
])
7979
->withPHPStanConfigs([
80-
__DIR__ . '/phpstan.neon.dist',
8180
__DIR__ . '/vendor/codeigniter/phpstan-codeigniter/extension.neon',
8281
__DIR__ . '/vendor/phpstan/phpstan-strict-rules/rules.neon',
8382
__DIR__ . '/vendor/shipmonk/phpstan-baseline-per-identifier/extension.neon',
83+
__DIR__ . '/phpstan.neon.dist',
8484
])
8585
// is there a file you need to skip?
8686
->withSkip([

system/Config/BaseService.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,9 @@ public static function resetSingle(string $name)
445445
*/
446446
public static function injectMock(string $name, $mock)
447447
{
448-
static::$instances[$name] = $mock;
449-
static::$mocks[strtolower($name)] = $mock;
448+
$name = strtolower($name);
449+
static::$instances[$name] = $mock;
450+
static::$mocks[$name] = $mock;
450451
}
451452

452453
/**

system/Filters/Filters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ public function getRequiredFilters(string $position = 'before'): array
375375
{
376376
// For backward compatibility. For users who do not update Config\Filters.
377377
if (! isset($this->config->required[$position])) {
378-
$baseConfig = config(BaseFiltersConfig::class); // @phpstan-ignore-line
378+
$baseConfig = config(BaseFiltersConfig::class);
379379
$filters = $baseConfig->required[$position];
380380
$aliases = $baseConfig->aliases;
381381
} else {

system/Images/Image.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ class Image extends File
2626
/**
2727
* The original image width in pixels.
2828
*
29-
* @var float|int
29+
* @var int
3030
*/
3131
public $origWidth;
3232

3333
/**
3434
* The original image height in pixels.
3535
*
36-
* @var float|int
36+
* @var int
3737
*/
3838
public $origHeight;
3939

tests/system/CommonSingleServiceTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public function testSingleServiceWithNoParamsSupplied(string $service): void
3434
{
3535
Services::injectMock('security', new MockSecurity(new SecurityConfig()));
3636

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

4040
$this->assertNotNull($service1);
4141

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

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

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

6868
$this->assertNotNull($service1);
6969

tests/system/Config/DotEnvTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static function provideLoadsVars(): iterable
9393
public function testLoadsHex2Bin(): void
9494
{
9595
putenv('encryption.key');
96-
unset($_ENV['encryption.key'], $_SERVER['encryption.key']); // @phpstan-ignore codeigniter.superglobalAccess
96+
unset($_ENV['encryption.key'], $_SERVER['encryption.key']);
9797

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

113113
$dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env');
114114
$dotenv->load();

tests/system/Entity/EntityTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ public function testCastEnumNullable(): void
906906

907907
$entity->status = null;
908908

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

911911
$entity->status = 'pending';
912912

@@ -1573,7 +1573,7 @@ public function testDataCasterInitEmptyCasts(): void
15731573

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

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

tests/system/Models/DataConverterModelTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testFindAsArray(): void
3636

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

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

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

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

@@ -208,7 +208,7 @@ public function testFirstAsArray(): void
208208

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

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

@@ -265,7 +265,7 @@ public function testInsertArray(): void
265265

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

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

271271
public function testInsertObject(): void
@@ -281,7 +281,7 @@ public function testInsertObject(): void
281281

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

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

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

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

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

297297
$this->assertSame([
298298
'john@example.com',
299299
'private@example.org',
300-
], $user['email']); // @phpstan-ignore offsetAccess.notFound
300+
], $user['email']);
301301
}
302302

303303
public function testUpdateObject(): void
@@ -313,7 +313,7 @@ public function testUpdateObject(): void
313313
$this->assertSame([
314314
'john@example.com',
315315
'private@example.org',
316-
], $user['email']); // @phpstan-ignore offsetAccess.notFound
316+
], $user['email']);
317317
}
318318

319319
public function testUpdateCustomObject(): void
@@ -365,7 +365,7 @@ public function testSaveArray(): void
365365
$this->assertSame([
366366
'john@example.com',
367367
'private@example.org',
368-
], $user['email']); // @phpstan-ignore offsetAccess.notFound
368+
], $user['email']);
369369
}
370370

371371
public function testSaveObject(): void
@@ -381,7 +381,7 @@ public function testSaveObject(): void
381381
$this->assertSame([
382382
'john@example.com',
383383
'private@example.org',
384-
], $user['email']); // @phpstan-ignore offsetAccess.notFound
384+
], $user['email']);
385385
}
386386

387387
public function testSaveCustomObject(): void

0 commit comments

Comments
 (0)