Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update return type of spl_autoload_functions on PHP8.0+ #2810

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/baseline-8.0.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
ignoreErrors:
-
message: "#^Strict comparison using \\=\\=\\= between array and false will always evaluate to false\\.$#"
message: "#^Strict comparison using \\=\\=\\= between list<callable\\(string\\): void> and false will always evaluate to false\\.$#"
count: 1
path: ../src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php

Expand Down
2 changes: 1 addition & 1 deletion build/spl-autoload-functions-php-8.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
parameters:
ignoreErrors:
-
message: "#^PHPDoc tag @var with type array\\<callable\\>\\|false is not subtype of native type array\\.$#"
message: "#^PHPDoc tag @var with type list\\<callable\\(string\\): void\\>\\|false is not subtype of native type list\\<callable\\(string\\): void\\>\\.$#"
count: 2
path: ../src/Command/CommandHelper.php
5 changes: 0 additions & 5 deletions build/spl-autoload-functions-pre-php-7.neon
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^PHPDoc tag @var with type array\\<callable\\(\\)\\: mixed\\>\\|false is not subtype of native type list\\<callable\\(string\\)\\: void\\>\\|false\\.$#"
count: 2
path: ../src/Command/CommandHelper.php

-
message: '#^Parameter \#1 \$array \(list<PHPStan\\Type\\Type>\) of array_values is already a list, call has no effect\.$#'
path: ../src/Type/TypeCombinator.php
1 change: 1 addition & 0 deletions resources/functionMap_php80delta.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
'socket_addrinfo_lookup' => ['AddressInfo[]', 'node'=>'string', 'service='=>'mixed', 'hints='=>'array'],
'socket_select' => ['int|false', '&w_read'=>'Socket[]|null', '&w_write'=>'Socket[]|null', '&w_except'=>'Socket[]|null', 'seconds'=>'int|null', 'microseconds='=>'int'],
'sodium_crypto_aead_chacha20poly1305_ietf_decrypt' => ['string|false', 'confidential_message'=>'string', 'public_message'=>'string', 'nonce'=>'string', 'key'=>'string'],
'spl_autoload_functions' => ['list<callable(string):void>'],
'str_contains' => ['bool', 'haystack'=>'string', 'needle'=>'string'],
'str_split' => ['non-empty-list<string>', 'str'=>'string', 'split_length='=>'positive-int'],
'str_ends_with' => ['bool', 'haystack'=>'string', 'needle'=>'string'],
Expand Down
4 changes: 2 additions & 2 deletions src/Command/CommandHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public static function begin(
$currentWorkingDirectoryFileHelper = new FileHelper($currentWorkingDirectory);
$currentWorkingDirectory = $currentWorkingDirectoryFileHelper->getWorkingDirectory();

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

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

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

if ($autoloadFunctionsBefore !== false && $autoloadFunctionsAfter !== false) {
Expand Down
Loading