Skip to content

Commit 05a02c9

Browse files
authored
chore: fixes for php-cs-fixer and psalm (#10105)
1 parent df914e2 commit 05a02c9

File tree

33 files changed

+59
-224
lines changed

33 files changed

+59
-224
lines changed

app/Config/Routes.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22

33
use CodeIgniter\Router\RouteCollection;
44

5-
/**
6-
* @var RouteCollection $routes
7-
*/
5+
/** @var RouteCollection $routes */
86
$routes->get('/', 'Home::index');

app/Config/View.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
use CodeIgniter\Config\View as BaseView;
66
use CodeIgniter\View\ViewDecoratorInterface;
77

8-
/**
9-
* @phpstan-type parser_callable (callable(mixed): mixed)
10-
* @phpstan-type parser_callable_string (callable(mixed): mixed)&string
11-
*/
128
class View extends BaseView
139
{
1410
/**
@@ -34,8 +30,7 @@ class View extends BaseView
3430
* { title|esc(js) }
3531
* { created_on|date(Y-m-d)|esc(attr) }
3632
*
37-
* @var array<string, string>
38-
* @phpstan-var array<string, parser_callable_string>
33+
* @var array<string, (callable(mixed): mixed)&string>
3934
*/
4035
public $filters = [];
4136

@@ -44,8 +39,7 @@ class View extends BaseView
4439
* by the core Parser by creating aliases that will be replaced with
4540
* any callable. Can be single or tag pair.
4641
*
47-
* @var array<string, callable|list<string>|string>
48-
* @phpstan-var array<string, list<parser_callable_string>|parser_callable_string|parser_callable>
42+
* @var array<string, (callable(mixed): mixed)|((callable(mixed): mixed)&string)|list<(callable(mixed): mixed)&string>>
4943
*/
5044
public $plugins = [];
5145

psalm-baseline.xml

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="6.14.3@d0b040a91f280f071c1abcb1b77ce3822058725a">
3-
<file src="app/Config/View.php">
4-
<UndefinedDocblockClass>
5-
<code><![CDATA[array<string, list<parser_callable_string>|parser_callable_string|parser_callable>]]></code>
6-
<code><![CDATA[array<string, list<parser_callable_string>|parser_callable_string|parser_callable>]]></code>
7-
<code><![CDATA[array<string, parser_callable_string>]]></code>
8-
<code><![CDATA[public $filters = [];]]></code>
9-
<code><![CDATA[public $plugins = [];]]></code>
10-
<code><![CDATA[public $plugins = [];]]></code>
11-
</UndefinedDocblockClass>
12-
</file>
13-
<file src="system/Config/View.php">
14-
<UndefinedDocblockClass>
15-
<code><![CDATA[array<string, array<parser_callable_string>|parser_callable_string|parser_callable>]]></code>
16-
<code><![CDATA[array<string, array<parser_callable_string>|parser_callable_string|parser_callable>]]></code>
17-
<code><![CDATA[array<string, parser_callable_string>]]></code>
18-
</UndefinedDocblockClass>
19-
</file>
2+
<files psalm-version="6.16.1@f1f5de594dc76faf8784e02d3dc4716c91c6f6ac">
203
<file src="system/Database/OCI8/Connection.php">
214
<UndefinedConstant>
225
<code><![CDATA[OCI_COMMIT_ON_SUCCESS]]></code>
@@ -73,14 +56,6 @@
7356
<code><![CDATA[$message]]></code>
7457
</NoValue>
7558
</file>
76-
<file src="system/View/Parser.php">
77-
<UndefinedDocblockClass>
78-
<code><![CDATA[array<string, array<parser_callable_string>|parser_callable_string|parser_callable>]]></code>
79-
<code><![CDATA[array<string, array<parser_callable_string>|parser_callable_string|parser_callable>]]></code>
80-
<code><![CDATA[protected $plugins = [];]]></code>
81-
<code><![CDATA[protected $plugins = [];]]></code>
82-
</UndefinedDocblockClass>
83-
</file>
8459
<file src="tests/_support/Config/Filters.php">
8560
<UndefinedGlobalVariable>
8661
<code><![CDATA[$filters]]></code>
@@ -136,51 +111,6 @@
136111
<code><![CDATA[$_SESSION['_ci_old_input']]]></code>
137112
</EmptyArrayAccess>
138113
</file>
139-
<file src="tests/system/Models/InsertModelTest.php">
140-
<InaccessibleProperty>
141-
<code><![CDATA[$entity->country]]></code>
142-
<code><![CDATA[$entity->created_at]]></code>
143-
<code><![CDATA[$entity->deleted]]></code>
144-
<code><![CDATA[$entity->email]]></code>
145-
<code><![CDATA[$entity->name]]></code>
146-
<code><![CDATA[$entityTwo->country]]></code>
147-
<code><![CDATA[$entityTwo->created_at]]></code>
148-
<code><![CDATA[$entityTwo->deleted]]></code>
149-
<code><![CDATA[$entityTwo->email]]></code>
150-
<code><![CDATA[$entityTwo->name]]></code>
151-
</InaccessibleProperty>
152-
</file>
153-
<file src="tests/system/Models/SaveModelTest.php">
154-
<InaccessibleProperty>
155-
<code><![CDATA[$entity->country]]></code>
156-
<code><![CDATA[$entity->created_at]]></code>
157-
<code><![CDATA[$entity->created_at]]></code>
158-
<code><![CDATA[$entity->deleted]]></code>
159-
<code><![CDATA[$entity->email]]></code>
160-
<code><![CDATA[$entity->name]]></code>
161-
<code><![CDATA[$entity->name]]></code>
162-
<code><![CDATA[$entity->name]]></code>
163-
<code><![CDATA[$entity->name]]></code>
164-
</InaccessibleProperty>
165-
</file>
166-
<file src="tests/system/Models/UpdateModelTest.php">
167-
<InaccessibleProperty>
168-
<code><![CDATA[$entity->country]]></code>
169-
<code><![CDATA[$entity->deleted]]></code>
170-
<code><![CDATA[$entity->email]]></code>
171-
<code><![CDATA[$entity->id]]></code>
172-
<code><![CDATA[$entity->name]]></code>
173-
<code><![CDATA[$entity1->country]]></code>
174-
<code><![CDATA[$entity1->country]]></code>
175-
<code><![CDATA[$entity1->deleted]]></code>
176-
<code><![CDATA[$entity1->id]]></code>
177-
<code><![CDATA[$entity1->name]]></code>
178-
<code><![CDATA[$entity2->country]]></code>
179-
<code><![CDATA[$entity2->deleted]]></code>
180-
<code><![CDATA[$entity2->id]]></code>
181-
<code><![CDATA[$entity2->name]]></code>
182-
</InaccessibleProperty>
183-
</file>
184114
<file src="tests/system/Test/ControllerTestTraitTest.php">
185115
<UndefinedClass>
186116
<code><![CDATA[NeverHeardOfIt]]></code>

system/Autoloader/Autoloader.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,7 @@ protected function discoverComposerNamespaces()
480480
return;
481481
}
482482

483-
/**
484-
* @var ClassLoader $composer
485-
*/
483+
/** @var ClassLoader $composer */
486484
$composer = include $this->composerPath;
487485
$paths = $composer->getPrefixesPsr4();
488486
$classes = $composer->getClassMap();

system/CLI/GeneratorTrait.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,7 @@ private function normalizeInputClassName(): string
303303

304304
$component = singular($this->component);
305305

306-
/**
307-
* @see https://regex101.com/r/a5KNCR/2
308-
*/
306+
/** @see https://regex101.com/r/a5KNCR/2 */
309307
$pattern = sprintf('/([a-z][a-z0-9_\/\\\\]+)(%s)$/i', $component);
310308

311309
if (preg_match($pattern, $class, $matches) === 1) {

system/Cache/Handlers/PredisHandler.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,9 @@ public function get(string $key): mixed
9292
}
9393

9494
return match ($data['__ci_type']) {
95-
'array', 'object' => unserialize($data['__ci_value']),
96-
// Yes, 'double' is returned and NOT 'float'
95+
'array', 'object' => unserialize($data['__ci_value']),
9796
'boolean', 'integer', 'double', 'string', 'NULL' => settype($data['__ci_value'], $data['__ci_type']) ? $data['__ci_value'] : null,
98-
default => null,
97+
default => null,
9998
};
10099
}
101100

@@ -111,7 +110,7 @@ public function save(string $key, mixed $value, int $ttl = 60): bool
111110

112111
case 'boolean':
113112
case 'integer':
114-
case 'double': // Yes, 'double' is returned and NOT 'float'
113+
case 'double':
115114
case 'string':
116115
case 'NULL':
117116
break;

system/Cache/Handlers/RedisHandler.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,9 @@ public function get(string $key): mixed
108108
}
109109

110110
return match ($data['__ci_type']) {
111-
'array', 'object' => unserialize($data['__ci_value']),
112-
// Yes, 'double' is returned and NOT 'float'
111+
'array', 'object' => unserialize($data['__ci_value']),
113112
'boolean', 'integer', 'double', 'string', 'NULL' => settype($data['__ci_value'], $data['__ci_type']) ? $data['__ci_value'] : null,
114-
default => null,
113+
default => null,
115114
};
116115
}
117116

@@ -127,7 +126,7 @@ public function save(string $key, mixed $value, int $ttl = 60): bool
127126

128127
case 'boolean':
129128
case 'integer':
130-
case 'double': // Yes, 'double' is returned and NOT 'float'
129+
case 'double':
131130
case 'string':
132131
case 'NULL':
133132
break;

system/Commands/Translation/LocalizationSync.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ private function process(string $originalLocale, string $targetLocale): int
131131
),
132132
);
133133

134-
/**
135-
* @var array<non-empty-string, SplFileInfo> $files
136-
*/
134+
/** @var array<non-empty-string, SplFileInfo> $files */
137135
$files = iterator_to_array($iterator, true);
138136
ksort($files);
139137

system/Config/View.php

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@
1616
use CodeIgniter\View\ViewDecoratorInterface;
1717

1818
/**
19-
* View configuration
20-
*
21-
* @phpstan-type parser_callable (callable(mixed): mixed)
22-
* @phpstan-type parser_callable_string (callable(mixed): mixed)&string
19+
* View configuration.
2320
*/
2421
class View extends BaseConfig
2522
{
2623
/**
27-
* When false, the view method will clear the data between each
28-
* call.
24+
* When false, the view method will clear the data between each call.
2925
*
3026
* @var bool
3127
*/
@@ -41,8 +37,7 @@ class View extends BaseConfig
4137
*
4238
* @psalm-suppress UndefinedDocblockClass
4339
*
44-
* @var array<string, string>
45-
* @phpstan-var array<string, parser_callable_string>
40+
* @var array<string, (callable(mixed): mixed)&string>
4641
*/
4742
public $filters = [];
4843

@@ -53,18 +48,14 @@ class View extends BaseConfig
5348
*
5449
* @psalm-suppress UndefinedDocblockClass
5550
*
56-
* @var array<string, callable|list<string>|string>
57-
* @phpstan-var array<string, list<parser_callable_string>|parser_callable_string|parser_callable>
51+
* @var array<string, (callable(mixed): mixed)|((callable(mixed): mixed)&string)|list<(callable(mixed): mixed)&string>>
5852
*/
5953
public $plugins = [];
6054

6155
/**
6256
* Built-in View filters.
6357
*
64-
* @psalm-suppress UndefinedDocblockClass
65-
*
66-
* @var array<string, string>
67-
* @phpstan-var array<string, parser_callable_string>
58+
* @var array<string, (callable(mixed): mixed)&string>
6859
*/
6960
protected $coreFilters = [
7061
'abs' => '\abs',
@@ -93,10 +84,7 @@ class View extends BaseConfig
9384
/**
9485
* Built-in View plugins.
9586
*
96-
* @psalm-suppress UndefinedDocblockClass
97-
*
98-
* @var array<string, callable|list<string>|string>
99-
* @phpstan-var array<string, array<parser_callable_string>|parser_callable_string|parser_callable>
87+
* @var array<string, (callable(mixed): mixed)|((callable(mixed): mixed)&string)|list<(callable(mixed): mixed)&string>>
10088
*/
10189
protected $corePlugins = [
10290
'csp_script_nonce' => '\CodeIgniter\View\Plugins::cspScriptNonce',

system/Cookie/CookieStore.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ class CookieStore implements Countable, IteratorAggregate
4545
*/
4646
public static function fromCookieHeaders(array $headers, bool $raw = false)
4747
{
48-
/**
49-
* @var list<Cookie> $cookies
50-
*/
48+
/** @var list<Cookie> $cookies */
5149
$cookies = array_filter(array_map(static function (string $header) use ($raw) {
5250
try {
5351
return Cookie::fromHeaderString($header, $raw);

0 commit comments

Comments
 (0)