Skip to content

Commit 5ac7a1c

Browse files
authored
Update return type of spl_autoload_functions on PHP8.0+
1 parent 328b6ad commit 5ac7a1c

5 files changed

+5
-9
lines changed

build/baseline-8.0.neon

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Strict comparison using \\=\\=\\= between array and false will always evaluate to false\\.$#"
4+
message: "#^Strict comparison using \\=\\=\\= between list<callable\\(string\\): void> and false will always evaluate to false\\.$#"
55
count: 1
66
path: ../src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php
77

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^PHPDoc tag @var with type array\\<callable\\>\\|false is not subtype of native type array\\.$#"
4+
message: "#^PHPDoc tag @var with type list\\<callable\\(string\\): void\\>\\|false is not subtype of native type list\\<callable\\(string\\): void\\>\\.$#"
55
count: 2
66
path: ../src/Command/CommandHelper.php
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: "#^PHPDoc tag @var with type array\\<callable\\(\\)\\: mixed\\>\\|false is not subtype of native type list\\<callable\\(string\\)\\: void\\>\\|false\\.$#"
5-
count: 2
6-
path: ../src/Command/CommandHelper.php
7-
83
-
94
message: '#^Parameter \#1 \$array \(list<PHPStan\\Type\\Type>\) of array_values is already a list, call has no effect\.$#'
105
path: ../src/Type/TypeCombinator.php

resources/functionMap_php80delta.php

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
'socket_addrinfo_lookup' => ['AddressInfo[]', 'node'=>'string', 'service='=>'mixed', 'hints='=>'array'],
9999
'socket_select' => ['int|false', '&w_read'=>'Socket[]|null', '&w_write'=>'Socket[]|null', '&w_except'=>'Socket[]|null', 'seconds'=>'int|null', 'microseconds='=>'int'],
100100
'sodium_crypto_aead_chacha20poly1305_ietf_decrypt' => ['string|false', 'confidential_message'=>'string', 'public_message'=>'string', 'nonce'=>'string', 'key'=>'string'],
101+
'spl_autoload_functions' => ['list<callable(string):void>'],
101102
'str_contains' => ['bool', 'haystack'=>'string', 'needle'=>'string'],
102103
'str_split' => ['non-empty-list<string>', 'str'=>'string', 'split_length='=>'positive-int'],
103104
'str_ends_with' => ['bool', 'haystack'=>'string', 'needle'=>'string'],

src/Command/CommandHelper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public static function begin(
164164
$currentWorkingDirectoryFileHelper = new FileHelper($currentWorkingDirectory);
165165
$currentWorkingDirectory = $currentWorkingDirectoryFileHelper->getWorkingDirectory();
166166

167-
/** @var array<callable>|false $autoloadFunctionsBefore */
167+
/** @var list<callable(string): void>|false $autoloadFunctionsBefore */
168168
$autoloadFunctionsBefore = spl_autoload_functions();
169169

170170
if ($autoloadFile !== null) {
@@ -459,7 +459,7 @@ public static function begin(
459459
self::executeBootstrapFile($bootstrapFileFromArray, $container, $errorOutput, $debugEnabled);
460460
}
461461

462-
/** @var array<callable>|false $autoloadFunctionsAfter */
462+
/** @var list<callable(string): void>|false $autoloadFunctionsAfter */
463463
$autoloadFunctionsAfter = spl_autoload_functions();
464464

465465
if ($autoloadFunctionsBefore !== false && $autoloadFunctionsAfter !== false) {

0 commit comments

Comments
 (0)