From 0b4373fe93054a1eccc5483c345716ce538328fb Mon Sep 17 00:00:00 2001 From: Manuel Huber Date: Fri, 8 Dec 2023 12:57:12 +0100 Subject: [PATCH 1/2] Update return type of spl_autoload_functions on PHP8.0+ The documentation states that spl_autoload_functions might only return false on PHP versions up to 7.4; it will return an empty array on PHP8+. --- resources/functionMap_php80delta.php | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/functionMap_php80delta.php b/resources/functionMap_php80delta.php index 1b234d2280..11c65e5258 100644 --- a/resources/functionMap_php80delta.php +++ b/resources/functionMap_php80delta.php @@ -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'], 'str_contains' => ['bool', 'haystack'=>'string', 'needle'=>'string'], 'str_split' => ['non-empty-list', 'str'=>'string', 'split_length='=>'positive-int'], 'str_ends_with' => ['bool', 'haystack'=>'string', 'needle'=>'string'], From 583d52c04f13b055d1b593a4d2a6d352ccac127b Mon Sep 17 00:00:00 2001 From: Manuel Huber Date: Fri, 27 Sep 2024 20:09:38 +0200 Subject: [PATCH 2/2] fix errors with spl_autoload_functions --- build/baseline-8.0.neon | 2 +- build/spl-autoload-functions-php-8.neon | 2 +- build/spl-autoload-functions-pre-php-7.neon | 5 ----- src/Command/CommandHelper.php | 4 ++-- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/build/baseline-8.0.neon b/build/baseline-8.0.neon index 3e0d07184d..95dfa6cf8a 100644 --- a/build/baseline-8.0.neon +++ b/build/baseline-8.0.neon @@ -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 and false will always evaluate to false\\.$#" count: 1 path: ../src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php diff --git a/build/spl-autoload-functions-php-8.neon b/build/spl-autoload-functions-php-8.neon index b534d6c94f..3669321889 100644 --- a/build/spl-autoload-functions-php-8.neon +++ b/build/spl-autoload-functions-php-8.neon @@ -1,6 +1,6 @@ parameters: ignoreErrors: - - message: "#^PHPDoc tag @var with type array\\\\|false is not subtype of native type array\\.$#" + message: "#^PHPDoc tag @var with type list\\\\|false is not subtype of native type list\\\\.$#" count: 2 path: ../src/Command/CommandHelper.php diff --git a/build/spl-autoload-functions-pre-php-7.neon b/build/spl-autoload-functions-pre-php-7.neon index abafcfbf08..42cd820e71 100644 --- a/build/spl-autoload-functions-pre-php-7.neon +++ b/build/spl-autoload-functions-pre-php-7.neon @@ -1,10 +1,5 @@ parameters: ignoreErrors: - - - message: "#^PHPDoc tag @var with type array\\\\|false is not subtype of native type list\\\\|false\\.$#" - count: 2 - path: ../src/Command/CommandHelper.php - - message: '#^Parameter \#1 \$array \(list\) of array_values is already a list, call has no effect\.$#' path: ../src/Type/TypeCombinator.php diff --git a/src/Command/CommandHelper.php b/src/Command/CommandHelper.php index 55926064a2..b0219c9fac 100644 --- a/src/Command/CommandHelper.php +++ b/src/Command/CommandHelper.php @@ -164,7 +164,7 @@ public static function begin( $currentWorkingDirectoryFileHelper = new FileHelper($currentWorkingDirectory); $currentWorkingDirectory = $currentWorkingDirectoryFileHelper->getWorkingDirectory(); - /** @var array|false $autoloadFunctionsBefore */ + /** @var list|false $autoloadFunctionsBefore */ $autoloadFunctionsBefore = spl_autoload_functions(); if ($autoloadFile !== null) { @@ -459,7 +459,7 @@ public static function begin( self::executeBootstrapFile($bootstrapFileFromArray, $container, $errorOutput, $debugEnabled); } - /** @var array|false $autoloadFunctionsAfter */ + /** @var list|false $autoloadFunctionsAfter */ $autoloadFunctionsAfter = spl_autoload_functions(); if ($autoloadFunctionsBefore !== false && $autoloadFunctionsAfter !== false) {