Skip to content

Commit 15ab9e1

Browse files
committed
chore: update rector and phpstan with fixing
1 parent 7362d91 commit 15ab9e1

File tree

3 files changed

+136
-244
lines changed

3 files changed

+136
-244
lines changed

composer.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
"codeigniter/coding-standard": "^1.8.1",
3333
"nexusphp/tachycardia": "^2.0",
3434
"phpstan/extension-installer": "^1.4",
35-
"phpstan/phpstan": "^1.11",
36-
"phpstan/phpstan-strict-rules": "^1.6",
35+
"phpstan/phpstan": "^2.1.11",
36+
"phpstan/phpstan-strict-rules": "^2.0.4",
3737
"phpunit/phpcov": "^9.0.2 || ^10.0",
3838
"phpunit/phpunit": "^10.5.16 || ^11.2",
39-
"rector/rector": "1.2.3"
39+
"rector/rector": "2.0.11"
4040
},
4141
"minimum-stability": "dev",
4242
"prefer-stable": true,
@@ -77,6 +77,7 @@
7777
"cs-fix": "vendor/bin/php-cs-fixer fix --ansi --verbose --diff",
7878
"cs": "vendor/bin/php-cs-fixer fix --ansi --verbose --dry-run --diff",
7979
"rector": "vendor/bin/rector process --dry-run",
80+
"rector-fix": "vendor/bin/rector process",
8081
"phpstan": "bash -c \"XDEBUG_MODE=off phpstan analyse\"",
8182
"phpstan-baseline": "bash -c \"XDEBUG_MODE=off phpstan analyse --generate-baseline phpstan-baseline.php\"",
8283
"test": "vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml --coverage-php build/cov/coverage.cov --testsuite main"

phpstan-baseline.php

+41-203
Original file line numberDiff line numberDiff line change
@@ -2,332 +2,170 @@
22

33
$ignoreErrors = [];
44
$ignoreErrors[] = [
5-
// identifier: foreach.nonIterable
6-
'message' => '#^Argument of an invalid type array\\|Countable supplied for foreach, only iterables are supported\\.$#',
7-
'count' => 1,
8-
'path' => __DIR__ . '/src/Secure.php',
9-
];
10-
$ignoreErrors[] = [
11-
// identifier: offsetAccess.nonOffsetAccessible
12-
'message' => '#^Cannot access offset \'name\' on mixed\\.$#',
13-
'count' => 3,
14-
'path' => __DIR__ . '/src/Secure.php',
15-
];
16-
$ignoreErrors[] = [
17-
// identifier: missingType.return
185
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_convertPasswordToKey\\(\\) has no return type specified\\.$#',
6+
'identifier' => 'missingType.return',
197
'count' => 1,
208
'path' => __DIR__ . '/src/Secure.php',
219
];
2210
$ignoreErrors[] = [
23-
// identifier: missingType.parameter
2411
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_convertPasswordToKey\\(\\) has parameter \\$blockKey with no type specified\\.$#',
12+
'identifier' => 'missingType.parameter',
2513
'count' => 1,
2614
'path' => __DIR__ . '/src/Secure.php',
2715
];
2816
$ignoreErrors[] = [
29-
// identifier: missingType.parameter
3017
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_convertPasswordToKey\\(\\) has parameter \\$hashAlgorithm with no type specified\\.$#',
18+
'identifier' => 'missingType.parameter',
3119
'count' => 1,
3220
'path' => __DIR__ . '/src/Secure.php',
3321
];
3422
$ignoreErrors[] = [
35-
// identifier: missingType.parameter
3623
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_convertPasswordToKey\\(\\) has parameter \\$keyBits with no type specified\\.$#',
24+
'identifier' => 'missingType.parameter',
3725
'count' => 1,
3826
'path' => __DIR__ . '/src/Secure.php',
3927
];
4028
$ignoreErrors[] = [
41-
// identifier: missingType.parameter
4229
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_convertPasswordToKey\\(\\) has parameter \\$password with no type specified\\.$#',
30+
'identifier' => 'missingType.parameter',
4331
'count' => 1,
4432
'path' => __DIR__ . '/src/Secure.php',
4533
];
4634
$ignoreErrors[] = [
47-
// identifier: missingType.parameter
4835
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_convertPasswordToKey\\(\\) has parameter \\$saltValue with no type specified\\.$#',
36+
'identifier' => 'missingType.parameter',
4937
'count' => 1,
5038
'path' => __DIR__ . '/src/Secure.php',
5139
];
5240
$ignoreErrors[] = [
53-
// identifier: missingType.parameter
5441
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_convertPasswordToKey\\(\\) has parameter \\$spinCount with no type specified\\.$#',
42+
'identifier' => 'missingType.parameter',
5543
'count' => 1,
5644
'path' => __DIR__ . '/src/Secure.php',
5745
];
5846
$ignoreErrors[] = [
59-
// identifier: missingType.return
6047
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_createIV\\(\\) has no return type specified\\.$#',
48+
'identifier' => 'missingType.return',
6149
'count' => 1,
6250
'path' => __DIR__ . '/src/Secure.php',
6351
];
6452
$ignoreErrors[] = [
65-
// identifier: missingType.parameter
66-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_createIV\\(\\) has parameter \\$blockKey with no type specified\\.$#',
67-
'count' => 1,
68-
'path' => __DIR__ . '/src/Secure.php',
69-
];
70-
$ignoreErrors[] = [
71-
// identifier: missingType.parameter
72-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_createIV\\(\\) has parameter \\$blockSize with no type specified\\.$#',
73-
'count' => 1,
74-
'path' => __DIR__ . '/src/Secure.php',
75-
];
76-
$ignoreErrors[] = [
77-
// identifier: missingType.parameter
78-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_createIV\\(\\) has parameter \\$hashAlgorithm with no type specified\\.$#',
79-
'count' => 1,
80-
'path' => __DIR__ . '/src/Secure.php',
81-
];
82-
$ignoreErrors[] = [
83-
// identifier: missingType.parameter
84-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_createIV\\(\\) has parameter \\$saltValue with no type specified\\.$#',
85-
'count' => 1,
86-
'path' => __DIR__ . '/src/Secure.php',
87-
];
88-
$ignoreErrors[] = [
89-
// identifier: missingType.return
9053
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_createUInt32LEBuffer\\(\\) has no return type specified\\.$#',
54+
'identifier' => 'missingType.return',
9155
'count' => 1,
9256
'path' => __DIR__ . '/src/Secure.php',
9357
];
9458
$ignoreErrors[] = [
95-
// identifier: missingType.parameter
96-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_createUInt32LEBuffer\\(\\) has parameter \\$bufferSize with no type specified\\.$#',
97-
'count' => 1,
98-
'path' => __DIR__ . '/src/Secure.php',
99-
];
100-
$ignoreErrors[] = [
101-
// identifier: missingType.parameter
102-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_createUInt32LEBuffer\\(\\) has parameter \\$value with no type specified\\.$#',
103-
'count' => 1,
104-
'path' => __DIR__ . '/src/Secure.php',
105-
];
106-
$ignoreErrors[] = [
107-
// identifier: missingType.return
10859
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_crypt\\(\\) has no return type specified\\.$#',
60+
'identifier' => 'missingType.return',
10961
'count' => 1,
11062
'path' => __DIR__ . '/src/Secure.php',
11163
];
11264
$ignoreErrors[] = [
113-
// identifier: missingType.parameter
114-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_crypt\\(\\) has parameter \\$cipherAlgorithm with no type specified\\.$#',
115-
'count' => 1,
116-
'path' => __DIR__ . '/src/Secure.php',
117-
];
118-
$ignoreErrors[] = [
119-
// identifier: missingType.parameter
120-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_crypt\\(\\) has parameter \\$cipherChaining with no type specified\\.$#',
121-
'count' => 1,
122-
'path' => __DIR__ . '/src/Secure.php',
123-
];
124-
$ignoreErrors[] = [
125-
// identifier: missingType.parameter
126-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_crypt\\(\\) has parameter \\$encrypt with no type specified\\.$#',
127-
'count' => 1,
128-
'path' => __DIR__ . '/src/Secure.php',
129-
];
130-
$ignoreErrors[] = [
131-
// identifier: missingType.parameter
132-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_crypt\\(\\) has parameter \\$input with no type specified\\.$#',
133-
'count' => 1,
134-
'path' => __DIR__ . '/src/Secure.php',
135-
];
136-
$ignoreErrors[] = [
137-
// identifier: missingType.parameter
138-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_crypt\\(\\) has parameter \\$iv with no type specified\\.$#',
139-
'count' => 1,
140-
'path' => __DIR__ . '/src/Secure.php',
141-
];
142-
$ignoreErrors[] = [
143-
// identifier: missingType.parameter
144-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_crypt\\(\\) has parameter \\$key with no type specified\\.$#',
65+
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_crypt\\(\\) has parameter \\$key with no value type specified in iterable type array\\.$#',
66+
'identifier' => 'missingType.iterableValue',
14567
'count' => 1,
14668
'path' => __DIR__ . '/src/Secure.php',
14769
];
14870
$ignoreErrors[] = [
149-
// identifier: missingType.return
15071
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_cryptPackage\\(\\) has no return type specified\\.$#',
72+
'identifier' => 'missingType.return',
15173
'count' => 1,
15274
'path' => __DIR__ . '/src/Secure.php',
15375
];
15476
$ignoreErrors[] = [
155-
// identifier: missingType.parameter
156-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_cryptPackage\\(\\) has parameter \\$blockSize with no type specified\\.$#',
157-
'count' => 1,
158-
'path' => __DIR__ . '/src/Secure.php',
159-
];
160-
$ignoreErrors[] = [
161-
// identifier: missingType.parameter
162-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_cryptPackage\\(\\) has parameter \\$cipherAlgorithm with no type specified\\.$#',
163-
'count' => 1,
164-
'path' => __DIR__ . '/src/Secure.php',
165-
];
166-
$ignoreErrors[] = [
167-
// identifier: missingType.parameter
168-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_cryptPackage\\(\\) has parameter \\$cipherChaining with no type specified\\.$#',
169-
'count' => 1,
170-
'path' => __DIR__ . '/src/Secure.php',
171-
];
172-
$ignoreErrors[] = [
173-
// identifier: missingType.parameter
174-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_cryptPackage\\(\\) has parameter \\$encrypt with no type specified\\.$#',
175-
'count' => 1,
176-
'path' => __DIR__ . '/src/Secure.php',
177-
];
178-
$ignoreErrors[] = [
179-
// identifier: missingType.parameter
180-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_cryptPackage\\(\\) has parameter \\$hashAlgorithm with no type specified\\.$#',
181-
'count' => 1,
182-
'path' => __DIR__ . '/src/Secure.php',
183-
];
184-
$ignoreErrors[] = [
185-
// identifier: missingType.parameter
186-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_cryptPackage\\(\\) has parameter \\$input with no type specified\\.$#',
187-
'count' => 1,
188-
'path' => __DIR__ . '/src/Secure.php',
189-
];
190-
$ignoreErrors[] = [
191-
// identifier: missingType.parameter
192-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_cryptPackage\\(\\) has parameter \\$key with no type specified\\.$#',
193-
'count' => 1,
194-
'path' => __DIR__ . '/src/Secure.php',
195-
];
196-
$ignoreErrors[] = [
197-
// identifier: missingType.parameter
198-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_cryptPackage\\(\\) has parameter \\$saltValue with no type specified\\.$#',
199-
'count' => 1,
200-
'path' => __DIR__ . '/src/Secure.php',
201-
];
202-
$ignoreErrors[] = [
203-
// identifier: missingType.return
204-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_hash\\(\\) has no return type specified\\.$#',
205-
'count' => 1,
206-
'path' => __DIR__ . '/src/Secure.php',
207-
];
208-
$ignoreErrors[] = [
209-
// identifier: missingType.parameter
210-
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_hash\\(\\) has parameter \\$algorithm with no type specified\\.$#',
211-
'count' => 1,
212-
'path' => __DIR__ . '/src/Secure.php',
213-
];
214-
$ignoreErrors[] = [
215-
// identifier: missingType.parameter
21677
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_hash\\(\\) has parameter \\$buffers with no type specified\\.$#',
78+
'identifier' => 'missingType.parameter',
21779
'count' => 1,
21880
'path' => __DIR__ . '/src/Secure.php',
21981
];
22082
$ignoreErrors[] = [
221-
// identifier: return.type
22283
'message' => '#^Method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:output\\(\\) should return string but returns string\\|false\\.$#',
84+
'identifier' => 'return.type',
22385
'count' => 1,
22486
'path' => __DIR__ . '/src/Secure.php',
22587
];
22688
$ignoreErrors[] = [
227-
// identifier: argument.unpackNonIterable
228-
'message' => '#^Only iterables can be unpacked, array\\|false given in argument \\#2\\.$#',
229-
'count' => 1,
230-
'path' => __DIR__ . '/src/Secure.php',
231-
];
232-
$ignoreErrors[] = [
233-
// identifier: argument.type
234-
'message' => '#^Parameter \\#1 \\$array of function array_pad expects array, mixed given\\.$#',
235-
'count' => 1,
236-
'path' => __DIR__ . '/src/Secure.php',
237-
];
238-
$ignoreErrors[] = [
239-
// identifier: argument.type
240-
'message' => '#^Parameter \\#1 \\$array of function array_unshift expects array, array\\|false given\\.$#',
241-
'count' => 1,
242-
'path' => __DIR__ . '/src/Secure.php',
243-
];
244-
$ignoreErrors[] = [
245-
// identifier: argument.type
246-
'message' => '#^Parameter \\#1 \\$array of function array_values expects array, array\\|false given\\.$#',
247-
'count' => 1,
248-
'path' => __DIR__ . '/src/Secure.php',
249-
];
250-
$ignoreErrors[] = [
251-
// identifier: argument.type
252-
'message' => '#^Parameter \\#1 \\$data of method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:build\\(\\) expects array\\<string, mixed\\>, mixed given\\.$#',
253-
'count' => 1,
89+
'message' => '#^Offset \'name\' might not exist on array\\<string, string\\>\\|string\\.$#',
90+
'identifier' => 'offsetAccess.notFound',
91+
'count' => 3,
25492
'path' => __DIR__ . '/src/Secure.php',
25593
];
25694
$ignoreErrors[] = [
257-
// identifier: argument.type
258-
'message' => '#^Parameter \\#1 \\$filename of function file_get_contents expects string, string\\|false\\|null given\\.$#',
95+
'message' => '#^Only iterables can be unpacked, array\\|false given in argument \\#2\\.$#',
96+
'identifier' => 'argument.unpackNonIterable',
25997
'count' => 1,
26098
'path' => __DIR__ . '/src/Secure.php',
26199
];
262100
$ignoreErrors[] = [
263-
// identifier: argument.type
264-
'message' => '#^Parameter \\#1 \\$filename of method OLE_PPS_Root\\:\\:save\\(\\) expects string, string\\|false\\|null given\\.$#',
101+
'message' => '#^Parameter \\#1 \\$array of function array_pad expects array, mixed given\\.$#',
102+
'identifier' => 'argument.type',
265103
'count' => 1,
266104
'path' => __DIR__ . '/src/Secure.php',
267105
];
268106
$ignoreErrors[] = [
269-
// identifier: argument.type
270-
'message' => '#^Parameter \\#1 \\$qualifiedName of method SimpleXMLElement\\:\\:addChild\\(\\) expects string, mixed given\\.$#',
107+
'message' => '#^Parameter \\#1 \\$encryptionInfo of method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_buildEncryptionInfo\\(\\) expects array\\<string, array\\<string, array\\<string, int\\|string\\>\\>\\>, array\\<string, array\\<string, mixed\\>\\> given\\.$#',
108+
'identifier' => 'argument.type',
271109
'count' => 1,
272110
'path' => __DIR__ . '/src/Secure.php',
273111
];
274112
$ignoreErrors[] = [
275-
// identifier: argument.type
276113
'message' => '#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#',
114+
'identifier' => 'argument.type',
277115
'count' => 1,
278116
'path' => __DIR__ . '/src/Secure.php',
279117
];
280118
$ignoreErrors[] = [
281-
// identifier: argument.type
282119
'message' => '#^Parameter \\#1 \\$stream of function feof expects resource, resource\\|false given\\.$#',
120+
'identifier' => 'argument.type',
283121
'count' => 1,
284122
'path' => __DIR__ . '/src/Secure.php',
285123
];
286124
$ignoreErrors[] = [
287-
// identifier: argument.type
288125
'message' => '#^Parameter \\#1 \\$stream of function fread expects resource, resource\\|false given\\.$#',
126+
'identifier' => 'argument.type',
289127
'count' => 1,
290128
'path' => __DIR__ . '/src/Secure.php',
291129
];
292130
$ignoreErrors[] = [
293-
// identifier: argument.type
294131
'message' => '#^Parameter \\#1 \\$string of function bin2hex expects string, array\\<int, string\\>\\|string\\|false given\\.$#',
132+
'identifier' => 'argument.type',
295133
'count' => 1,
296134
'path' => __DIR__ . '/src/Secure.php',
297135
];
298136
$ignoreErrors[] = [
299-
// identifier: argument.type
300-
'message' => '#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\|false given\\.$#',
137+
'message' => '#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#',
138+
'identifier' => 'argument.type',
301139
'count' => 1,
302140
'path' => __DIR__ . '/src/Secure.php',
303141
];
304142
$ignoreErrors[] = [
305-
// identifier: argument.type
306-
'message' => '#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#',
143+
'message' => '#^Parameter \\#2 \\$data of method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:build\\(\\) expects array\\<string, array\\<string, array\\<string, string\\>\\|string\\>\\|int\\|string\\>, array\\<string, mixed\\> given\\.$#',
144+
'identifier' => 'argument.type',
307145
'count' => 1,
308146
'path' => __DIR__ . '/src/Secure.php',
309147
];
310148
$ignoreErrors[] = [
311-
// identifier: argument.type
312-
'message' => '#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#',
149+
'message' => '#^Parameter \\#2 \\$data of method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:build\\(\\) expects array\\<string, array\\<string, array\\<string, string\\>\\|string\\>\\|int\\|string\\>, array\\<string, string\\>\\|string given\\.$#',
150+
'identifier' => 'argument.type',
313151
'count' => 1,
314152
'path' => __DIR__ . '/src/Secure.php',
315153
];
316154
$ignoreErrors[] = [
317-
// identifier: argument.type
318-
'message' => '#^Parameter \\#2 \\$string of function unpack expects string, string\\|false given\\.$#',
319-
'count' => 3,
155+
'message' => '#^Parameter \\#2 \\$value of method SimpleXMLElement\\:\\:addAttribute\\(\\) expects string, array\\<string, string\\>\\|string given\\.$#',
156+
'identifier' => 'argument.type',
157+
'count' => 2,
320158
'path' => __DIR__ . '/src/Secure.php',
321159
];
322160
$ignoreErrors[] = [
323-
// identifier: argument.type
324-
'message' => '#^Parameter \\#2 \\$value of method SimpleXMLElement\\:\\:addAttribute\\(\\) expects string, mixed given\\.$#',
325-
'count' => 2,
161+
'message' => '#^Parameter \\#6 \\$input of method PHPDevsr\\\\Spreadsheet\\\\Secure\\:\\:_crypt\\(\\) expects array\\<int\\|string, int\\|string\\>, mixed given\\.$#',
162+
'identifier' => 'argument.type',
163+
'count' => 1,
326164
'path' => __DIR__ . '/src/Secure.php',
327165
];
328166
$ignoreErrors[] = [
329-
// identifier: argument.type
330167
'message' => '#^Parameter \\#2 \\$length of function fread expects int\\<1, max\\>, int\\<0, max\\> given\\.$#',
168+
'identifier' => 'argument.type',
331169
'count' => 1,
332170
'path' => __DIR__ . '/tests/SecureTest.php',
333171
];

0 commit comments

Comments
 (0)