Skip to content

Commit 6957bed

Browse files
committed
Fix code style and tests
1 parent 8737be3 commit 6957bed

6 files changed

+15
-13
lines changed

tests/Rules/Classes/FrameworkExceptionInstantiationRuleTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ public function testRule(): void
3838
$this->analyse([__DIR__ . '/data/framework-exception.php'], [
3939
[
4040
'Instantiating FrameworkException using new is not allowed. Use one of its named constructors instead.',
41-
17,
41+
18,
4242
],
4343
[
4444
'Instantiating ViewException using new is not allowed. Use one of its named constructors instead.',
45-
18,
45+
19,
4646
],
4747
[
4848
'Instantiating HTTPException using new is not allowed. Use one of its named constructors instead.',
49-
20,
49+
21,
5050
],
5151
]);
5252
}

tests/Rules/Classes/data/framework-exception.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
*/
1313

1414
use CodeIgniter\Exceptions\FrameworkException;
15+
use CodeIgniter\HTTP\Exceptions\HTTPException;
1516
use CodeIgniter\View\Exceptions\ViewException;
1617

1718
$e1 = new FrameworkException('Hello.');
1819
$e2 = new ViewException('Hi!');
1920
$e3 = new RuntimeException('Thanks.');
20-
$e4 = new CodeIgniter\HTTP\Exceptions\HTTPException('Nice');
21+
$e4 = new HTTPException('Nice');

tests/Rules/Functions/FactoriesFunctionArgumentTypeRuleTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,25 @@ public function testRule(): void
5959
], [
6060
[
6161
'Parameter #1 $name of function config expects a valid class string, \'bar\' given.',
62-
23,
62+
24,
6363
'If \'bar\' is a valid class string, you can add its possible namespace(s) in <fg=cyan>codeigniter.additionalConfigNamespaces</> in your <fg=yellow>%configurationFile%</>.',
6464
],
6565
[
6666
'Parameter #1 $name of function config expects a valid class string, \'Foo\\\\Bar\' given.',
67-
24,
67+
25,
6868
'If \'Foo\\\\Bar\' is a valid class string, you can add its possible namespace(s) in <fg=cyan>codeigniter.additionalConfigNamespaces</> in your <fg=yellow>%configurationFile%</>.',
6969
],
7070
[
7171
'Argument #1 $name (\'Foo\'|\'stdClass\') passed to function config does not extend CodeIgniter\\\\Config\\\\BaseConfig.',
72-
27,
72+
28,
7373
],
7474
[
7575
'Argument #1 $name (class-string) passed to function config does not extend CodeIgniter\\\\Config\\\\BaseConfig.',
76-
32,
76+
33,
7777
],
7878
[
7979
'Parameter #1 $name of function config expects a valid class string, string given.',
80-
35,
80+
36,
8181
],
8282
[
8383
'Parameter #1 $name of function model expects a valid class string, \'foo\' given.',

tests/Rules/Functions/NoClassConstFetchOnFactoriesFunctionsTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testRule(): void
4747
], [
4848
[
4949
'Call to function config with CodeIgniter\Shield\Config\AuthJWT::class is discouraged.',
50-
38,
50+
39,
5151
'Use config(\'AuthJWT\') instead to allow overriding.',
5252
],
5353
[

tests/Type/data/config.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace CodeIgniter\PHPStan\Tests\Fixtures\Type;
1515

16+
use CodeIgniter\Shield\Config\AuthJWT;
1617
use Config\App;
1718
use stdClass;
1819

@@ -35,4 +36,4 @@ function bar(string $name): void
3536
assertType('null', config($name));
3637
}
3738

38-
assertType('CodeIgniter\Shield\Config\AuthJWT', config(\CodeIgniter\Shield\Config\AuthJWT::class));
39+
assertType('CodeIgniter\Shield\Config\AuthJWT', config(AuthJWT::class));

tests/Type/data/reflection-helper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ public function testObjectAsObjectType(): void
4848

4949
$object = new Environment(service('logger'), service('commands'));
5050
assertType(
51-
'Closure(array<int|string, string|null>): (int|void)',
51+
'Closure(array<int|string, string|null>): int',
5252
self::getPrivateMethodInvoker($object, 'run'),
5353
);
5454
assertType('Closure(string): bool', self::getPrivateMethodInvoker($object, 'writeNewEnvironmentToEnvFile'));
5555

5656
$object = new ConfigCheck(service('logger'), service('commands'));
5757
assertType(
58-
'Closure(array<int|string, string|null>): (int|void)',
58+
'Closure(array<int|string, string|null>): int',
5959
self::getPrivateMethodInvoker($object, 'run'),
6060
);
6161
assertType('Closure(object): string', self::getPrivateMethodInvoker($object, 'getVarDump'));

0 commit comments

Comments
 (0)