From 9bb436ec28cf09b133cb17604feeedbf1fc914ff Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Thu, 25 Aug 2022 17:37:49 +0200 Subject: [PATCH] Update PHPStan --- composer.json | 2 +- composer.lock | 64 +++++----- phpstan/baseline-8.1.neon | 12 +- phpstan/baseline.neon | 133 ++++++++++---------- src/Composer/Autoload/AutoloadGenerator.php | 5 +- 5 files changed, 106 insertions(+), 110 deletions(-) diff --git a/composer.json b/composer.json index 85fbff553..780f051c4 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-deprecation-rules": "^1", "phpstan/phpstan-strict-rules": "^1", - "phpstan/phpstan-symfony": "^1.1" + "phpstan/phpstan-symfony": "^1.2.10" }, "suggest": { "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", diff --git a/composer.lock b/composer.lock index 5cca60e1d..8e4d6c816 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d3dba05c3c2010d8328f0795e69c7c8f", + "content-hash": "d21e692017f2adf98ee055e98100c018", "packages": [ { "name": "composer/ca-bundle", @@ -1959,16 +1959,16 @@ "packages-dev": [ { "name": "phpstan/phpstan", - "version": "1.8.2", + "version": "1.8.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c" + "reference": "5583623b61caafebd62bc78a99533aa9d769d097" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c53312ecc575caf07b0e90dee43883fdf90ca67c", - "reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5583623b61caafebd62bc78a99533aa9d769d097", + "reference": "5583623b61caafebd62bc78a99533aa9d769d097", "shasum": "" }, "require": { @@ -1992,9 +1992,13 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.2" + "source": "https://github.com/phpstan/phpstan/tree/1.8.3" }, "funding": [ { @@ -2005,16 +2009,12 @@ "url": "https://github.com/phpstan", "type": "github" }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, { "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", "type": "tidelift" } ], - "time": "2022-07-20T09:57:31+00:00" + "time": "2022-09-01T15:27:34+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -2120,21 +2120,21 @@ }, { "name": "phpstan/phpstan-strict-rules", - "version": "1.3.0", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "543675a9be82d4befb9ca0bd8cdc9d211665037f" + "reference": "431b3d6e8040075de196680cd5bc95735987b4ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/543675a9be82d4befb9ca0bd8cdc9d211665037f", - "reference": "543675a9be82d4befb9ca0bd8cdc9d211665037f", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/431b3d6e8040075de196680cd5bc95735987b4ae", + "reference": "431b3d6e8040075de196680cd5bc95735987b4ae", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.7.15" + "phpstan/phpstan": "^1.8.3" }, "require-dev": { "nikic/php-parser": "^4.13.0", @@ -2162,22 +2162,22 @@ "description": "Extra strict and opinionated rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.3.0" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.4.3" }, - "time": "2022-06-24T06:47:20+00:00" + "time": "2022-08-26T15:05:46+00:00" }, { "name": "phpstan/phpstan-symfony", - "version": "1.2.8", + "version": "1.2.13", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-symfony.git", - "reference": "28fe677ec3ad43eb4c0946c502535365e3040ecf" + "reference": "016e441a19a2af79ca0c60920ba0d61747b4e855" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/28fe677ec3ad43eb4c0946c502535365e3040ecf", - "reference": "28fe677ec3ad43eb4c0946c502535365e3040ecf", + "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/016e441a19a2af79ca0c60920ba0d61747b4e855", + "reference": "016e441a19a2af79ca0c60920ba0d61747b4e855", "shasum": "" }, "require": { @@ -2195,15 +2195,15 @@ "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": "^9.5", "psr/container": "1.0 || 1.1.1", - "symfony/config": "^4.2 || ^5.0", - "symfony/console": "^4.0 || ^5.0", - "symfony/dependency-injection": "^4.0 || ^5.0", - "symfony/form": "^4.0 || ^5.0", - "symfony/framework-bundle": "^4.4 || ^5.0", - "symfony/http-foundation": "^5.1", - "symfony/messenger": "^4.2 || ^5.0", + "symfony/config": "^5.4 || ^6.1", + "symfony/console": "^5.4 || ^6.1", + "symfony/dependency-injection": "^5.4 || ^6.1", + "symfony/form": "^5.4 || ^6.1", + "symfony/framework-bundle": "^5.4 || ^6.1", + "symfony/http-foundation": "^5.4 || ^6.1", + "symfony/messenger": "^5.4", "symfony/polyfill-php80": "^1.24", - "symfony/serializer": "^4.0 || ^5.0" + "symfony/serializer": "^5.4" }, "type": "phpstan-extension", "extra": { @@ -2233,9 +2233,9 @@ "description": "Symfony Framework extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-symfony/issues", - "source": "https://github.com/phpstan/phpstan-symfony/tree/1.2.8" + "source": "https://github.com/phpstan/phpstan-symfony/tree/1.2.13" }, - "time": "2022-07-20T12:02:52+00:00" + "time": "2022-08-28T13:34:45+00:00" }, { "name": "symfony/phpunit-bridge", diff --git a/phpstan/baseline-8.1.neon b/phpstan/baseline-8.1.neon index b22aed2f6..6a174a249 100644 --- a/phpstan/baseline-8.1.neon +++ b/phpstan/baseline-8.1.neon @@ -50,11 +50,6 @@ parameters: count: 1 path: ../src/Composer/Command/ShowCommand.php - - - message: "#^Parameter \\#1 \\$callback of function call_user_func expects callable\\(\\)\\: mixed, array\\{Composer\\\\Package\\\\RootPackageInterface, 'getDevRequires'\\|'getRequires'\\} given\\.$#" - count: 1 - path: ../src/Composer/Command/ValidateCommand.php - - message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{Composer\\\\Json\\\\JsonManipulator, string\\} given\\.$#" count: 1 @@ -185,6 +180,11 @@ parameters: count: 2 path: ../src/Composer/Util/Hg.php + - + message: "#^Only booleans are allowed in &&, int\\<0, 2097152\\> given on the right side\\.$#" + count: 1 + path: ../src/Composer/Util/Http/CurlDownloader.php + - message: "#^Parameter \\#1 \\$handle of function curl_close expects CurlHandle, resource given\\.$#" count: 1 @@ -236,7 +236,7 @@ parameters: path: ../src/Composer/Util/Http/CurlDownloader.php - - message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$jobs \\(array\\, retries\\: int\\<0, max\\>, storeAuth\\: 'prompt'\\|bool\\}, options\\: array, progress\\: array, curlHandle\\: resource, filename\\: string\\|null, headerHandle\\: resource, \\.\\.\\.\\}\\>\\) does not accept non\\-empty\\-array\\, retries\\: int\\<0, max\\>, storeAuth\\: 'prompt'\\|bool\\}, options\\: array, progress\\: array, curlHandle\\: CurlHandle\\|resource, filename\\: string\\|null, headerHandle\\: resource, \\.\\.\\.\\}\\>\\.$#" + message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$jobs \\(array\\, retries\\: int\\<0, max\\>, storeAuth\\: 'prompt'\\|bool\\}, options\\: array, progress\\: array, curlHandle\\: resource, filename\\: string\\|null, headerHandle\\: resource, \\.\\.\\.\\}\\>\\) does not accept non\\-empty\\-array\\, retries\\: int\\<0, max\\>, storeAuth\\: 'prompt'\\|bool\\}, options\\: array, progress\\: array, curlHandle\\: resource, filename\\: string\\|null, headerHandle\\: resource, \\.\\.\\.\\}\\|array\\{url\\: string, origin\\: string, attributes\\: array\\{retryAuthFailure\\: bool, redirects\\: int\\<0, max\\>, retries\\: int\\<0, max\\>, storeAuth\\: 'prompt'\\|bool\\}, options\\: array, progress\\: array\\<\\('certinfo'\\|'connect_time'\\|'content_type'\\|'download_content…'\\|'filetime'\\|'header_size'\\|'http_code'\\|'http_version'\\|'local_ip'\\|'local_port'\\|'namelookup_time'\\|'pretransfer_time'\\|'primary_ip'\\|'primary_port'\\|'protocol'\\|'redirect_count'\\|'redirect_time'\\|'redirect_url'\\|'request_size'\\|'scheme'\\|'size_download'\\|'size_upload'\\|'speed_download'\\|'speed_upload'\\|'ssl_verify_result'\\|'ssl_verifyresult'\\|'starttransfer_time'\\|'total_time'\\|'upload_content…'\\|'url'\\), \\(array\\\\>\\|float\\|int\\|string\\|null\\)\\>, curlHandle\\: CurlHandle, filename\\: string\\|null, headerHandle\\: resource, \\.\\.\\.\\}\\>\\.$#" count: 1 path: ../src/Composer/Util/Http/CurlDownloader.php diff --git a/phpstan/baseline.neon b/phpstan/baseline.neon index 9e57ace0a..9aa2908b1 100644 --- a/phpstan/baseline.neon +++ b/phpstan/baseline.neon @@ -6,7 +6,7 @@ parameters: path: ../src/Composer/Advisory/Auditor.php - - message: "#^Binary operation \"\\.\" between non\\-empty\\-string and array\\|string\\|null results in an error\\.$#" + message: "#^Binary operation \"\\.\" between non\\-falsy\\-string and array\\|string\\|null results in an error\\.$#" count: 1 path: ../src/Composer/Autoload/AutoloadGenerator.php @@ -20,11 +20,6 @@ parameters: count: 1 path: ../src/Composer/Autoload/AutoloadGenerator.php - - - message: "#^Only booleans are allowed in &&, array\\\\|int\\|string\\>\\|bool\\|string\\>\\|bool\\|string\\|null given on the left side\\.$#" - count: 1 - path: ../src/Composer/Autoload/AutoloadGenerator.php - - message: "#^Only booleans are allowed in &&, bool\\|null given on the left side\\.$#" count: 1 @@ -510,11 +505,6 @@ parameters: count: 1 path: ../src/Composer/Command/InitCommand.php - - - message: "#^Binary operation \"\\.\" between 'The package name ' and non\\-empty\\-array\\|float\\|int\\\\|int\\<1, max\\>\\|non\\-empty\\-string\\|true results in an error\\.$#" - count: 1 - path: ../src/Composer/Command/InitCommand.php - - message: "#^Cannot call method get\\(\\) on Symfony\\\\Component\\\\Console\\\\Helper\\\\HelperSet\\|null\\.$#" count: 1 @@ -556,8 +546,8 @@ parameters: path: ../src/Composer/Command/InitCommand.php - - message: "#^Parameter \\#1 \\$author of method Composer\\\\Command\\\\InitCommand\\:\\:formatAuthors\\(\\) expects string, array\\|float\\|int\\\\|int\\<1, max\\>\\|string\\|true given\\.$#" - count: 1 + message: "#^Only booleans are allowed in an if condition, string\\|null given\\.$#" + count: 2 path: ../src/Composer/Command/InitCommand.php - @@ -566,12 +556,12 @@ parameters: path: ../src/Composer/Command/InitCommand.php - - message: "#^Parameter \\#1 \\$path of function basename expects string, string\\|false given\\.$#" - count: 1 + message: "#^Parameter \\#1 \\$options of method Composer\\\\Command\\\\InitCommand\\:\\:hasDependencies\\(\\) expects array\\\\|string\\>, array\\\\|stdClass\\|string\\> given\\.$#" + count: 2 path: ../src/Composer/Command/InitCommand.php - - message: "#^Parameter \\#2 \\$subject of static method Composer\\\\Pcre\\\\Preg\\:\\:isMatch\\(\\) expects string, array\\|float\\|int\\\\|int\\<1, max\\>\\|string\\|true given\\.$#" + message: "#^Parameter \\#1 \\$path of function basename expects string, string\\|false given\\.$#" count: 1 path: ../src/Composer/Command/InitCommand.php @@ -735,18 +725,13 @@ parameters: count: 1 path: ../src/Composer/Command/ShowCommand.php - - - message: "#^Binary operation \"\\.\" between ' in ' and array\\|bool\\|float\\|int\\|string results in an error\\.$#" - count: 1 - path: ../src/Composer/Command/ShowCommand.php - - message: "#^Binary operation \"\\.\" between '\\latest\\…' and array\\\\|string results in an error\\.$#" count: 1 path: ../src/Composer/Command/ShowCommand.php - - message: "#^Binary operation \"\\.\" between non\\-empty\\-string and array\\\\|string results in an error\\.$#" + message: "#^Binary operation \"\\.\" between non\\-falsy\\-string and array\\\\|string results in an error\\.$#" count: 1 path: ../src/Composer/Command/ShowCommand.php @@ -1120,11 +1105,6 @@ parameters: count: 5 path: ../src/Composer/Command/ValidateCommand.php - - - message: "#^Parameter \\#1 \\$function of function call_user_func expects callable\\(\\)\\: mixed, array\\{Composer\\\\Package\\\\RootPackageInterface, 'getDevRequires'\\|'getRequires'\\} given\\.$#" - count: 1 - path: ../src/Composer/Command/ValidateCommand.php - - message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#" count: 1 @@ -1185,11 +1165,6 @@ parameters: count: 1 path: ../src/Composer/Config.php - - - message: "#^Only booleans are allowed in an if condition, bool\\|string given\\.$#" - count: 1 - path: ../src/Composer/Config.php - - message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#" count: 1 @@ -1980,11 +1955,6 @@ parameters: count: 3 path: ../src/Composer/Downloader/HgDownloader.php - - - message: "#^Call to function in_array\\(\\) with arguments 20, array\\{0\\: 10\\|20, 1\\?\\: 20\\} and true will always evaluate to true\\.$#" - count: 2 - path: ../src/Composer/Downloader/PathDownloader.php - - message: "#^Only booleans are allowed in an if condition, array\\\\|null given\\.$#" count: 1 @@ -2727,7 +2697,22 @@ parameters: - message: "#^Only booleans are allowed in an if condition, int given\\.$#" - count: 5 + count: 1 + path: ../src/Composer/Installer/SuggestedPackagesReporter.php + + - + message: "#^Only booleans are allowed in an if condition, int\\<0, 1\\> given\\.$#" + count: 1 + path: ../src/Composer/Installer/SuggestedPackagesReporter.php + + - + message: "#^Only booleans are allowed in an if condition, int\\<0, 2\\> given\\.$#" + count: 2 + path: ../src/Composer/Installer/SuggestedPackagesReporter.php + + - + message: "#^Only booleans are allowed in an if condition, int\\<0, 4\\> given\\.$#" + count: 1 path: ../src/Composer/Installer/SuggestedPackagesReporter.php - @@ -2741,7 +2726,7 @@ parameters: path: ../src/Composer/Json/JsonFile.php - - message: "#^Only booleans are allowed in a ternary operator condition, int given\\.$#" + message: "#^Only booleans are allowed in a ternary operator condition, int\\<0, 128\\> given\\.$#" count: 1 path: ../src/Composer/Json/JsonFile.php @@ -3071,7 +3056,7 @@ parameters: path: ../src/Composer/Package/Loader/ValidatingArrayLoader.php - - message: "#^Cannot access offset 'scheme' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#" + message: "#^Cannot access offset 'scheme' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int\\<0, 65535\\>, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#" count: 1 path: ../src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -3086,8 +3071,13 @@ parameters: path: ../src/Composer/Package/Loader/ValidatingArrayLoader.php - - message: "#^Only booleans are allowed in &&, int given on the left side\\.$#" - count: 2 + message: "#^Only booleans are allowed in &&, int\\<0, 1\\> given on the left side\\.$#" + count: 1 + path: ../src/Composer/Package/Loader/ValidatingArrayLoader.php + + - + message: "#^Only booleans are allowed in &&, int\\<0, 2\\> given on the left side\\.$#" + count: 1 path: ../src/Composer/Package/Loader/ValidatingArrayLoader.php - @@ -3216,7 +3206,7 @@ parameters: path: ../src/Composer/Package/Version/VersionGuesser.php - - message: "#^Offset 'feature_pretty…' does not exist on array\\{version\\: non\\-empty\\-string, commit\\: string\\|null, pretty_version\\: string\\|null, feature_version\\: non\\-empty\\-string, feature_pretty_version\\?\\: string\\|null\\}\\.$#" + message: "#^Offset 'feature_pretty…' does not exist on array\\{version\\: non\\-falsy\\-string, commit\\: string\\|null, pretty_version\\: string\\|null, feature_version\\: non\\-falsy\\-string, feature_pretty_version\\?\\: string\\|null\\}\\.$#" count: 1 path: ../src/Composer/Package/Version/VersionGuesser.php @@ -3436,7 +3426,7 @@ parameters: path: ../src/Composer/Repository/ArtifactRepository.php - - message: "#^Cannot access offset 'path' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#" + message: "#^Cannot access offset 'path' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int\\<0, 65535\\>, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#" count: 1 path: ../src/Composer/Repository/ComposerRepository.php @@ -4409,7 +4399,7 @@ parameters: path: ../src/Composer/Util/ConfigValidator.php - - message: "#^Only booleans are allowed in &&, int given on the left side\\.$#" + message: "#^Only booleans are allowed in &&, int\\<0, 1\\> given on the left side\\.$#" count: 1 path: ../src/Composer/Util/ConfigValidator.php @@ -4548,9 +4538,19 @@ parameters: count: 3 path: ../src/Composer/Util/Http/CurlDownloader.php + - + message: "#^Offset \\(int\\|string\\) on array\\, retries\\: int\\<0, max\\>, storeAuth\\: 'prompt'\\|bool\\}, options\\: array, progress\\: array, curlHandle\\: resource, filename\\: string\\|null, headerHandle\\: resource, \\.\\.\\.\\}\\> in isset\\(\\) always exists and is not nullable\\.$#" + count: 1 + path: ../src/Composer/Util/Http/CurlDownloader.php + - message: "#^Only booleans are allowed in &&, int given on the right side\\.$#" - count: 2 + count: 1 + path: ../src/Composer/Util/Http/CurlDownloader.php + + - + message: "#^Only booleans are allowed in &&, int\\<0, 65536\\> given on the right side\\.$#" + count: 1 path: ../src/Composer/Util/Http/CurlDownloader.php - @@ -4684,12 +4684,12 @@ parameters: path: ../src/Composer/Util/Http/CurlDownloader.php - - message: "#^Cannot access offset 'host' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#" + message: "#^Cannot access offset 'host' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int\\<0, 65535\\>, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#" count: 1 path: ../src/Composer/Util/Http/ProxyHelper.php - - message: "#^Cannot access offset 'user' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#" + message: "#^Cannot access offset 'user' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int\\<0, 65535\\>, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#" count: 1 path: ../src/Composer/Util/Http/ProxyHelper.php @@ -4709,7 +4709,7 @@ parameters: path: ../src/Composer/Util/Http/ProxyHelper.php - - message: "#^Only booleans are allowed in a negated boolean, int\\|false\\|null given\\.$#" + message: "#^Only booleans are allowed in a negated boolean, int\\<0, 65535\\>\\|false\\|null given\\.$#" count: 1 path: ../src/Composer/Util/Http/ProxyHelper.php @@ -4719,7 +4719,7 @@ parameters: path: ../src/Composer/Util/Http/ProxyHelper.php - - message: "#^Parameter \\#1 \\$proxy of static method Composer\\\\Util\\\\Http\\\\ProxyHelper\\:\\:formatParsedUrl\\(\\) expects array\\{scheme\\?\\: string, host\\: string, port\\?\\: int, user\\?\\: string, pass\\?\\: string\\}, array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false given\\.$#" + message: "#^Parameter \\#1 \\$proxy of static method Composer\\\\Util\\\\Http\\\\ProxyHelper\\:\\:formatParsedUrl\\(\\) expects array\\{scheme\\?\\: string, host\\: string, port\\?\\: int, user\\?\\: string, pass\\?\\: string\\}, array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int\\<0, 65535\\>, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false given\\.$#" count: 1 path: ../src/Composer/Util/Http/ProxyHelper.php @@ -4899,7 +4899,7 @@ parameters: path: ../src/Composer/Util/NoProxyPattern.php - - message: "#^Only booleans are allowed in a ternary operator condition, int\\|false\\|null given\\.$#" + message: "#^Only booleans are allowed in a ternary operator condition, int\\<0, 65535\\>\\|false\\|null given\\.$#" count: 1 path: ../src/Composer/Util/NoProxyPattern.php @@ -5139,7 +5139,7 @@ parameters: path: ../src/Composer/Util/RemoteFilesystem.php - - message: "#^Parameter \\#1 \\$result of method Composer\\\\Util\\\\RemoteFilesystem\\:\\:decodeResult\\(\\) expects string\\|false, non\\-empty\\-string\\|true given\\.$#" + message: "#^Parameter \\#1 \\$result of method Composer\\\\Util\\\\RemoteFilesystem\\:\\:decodeResult\\(\\) expects string\\|false, non\\-falsy\\-string\\|true given\\.$#" count: 1 path: ../src/Composer/Util/RemoteFilesystem.php @@ -5188,11 +5188,6 @@ parameters: count: 1 path: ../src/Composer/Util/StreamContextFactory.php - - - message: "#^Method Composer\\\\Util\\\\StreamContextFactory\\:\\:initOptions\\(\\) should return array\\{http\\: array\\{header\\: array\\, proxy\\?\\: string, request_fulluri\\: bool\\}, ssl\\?\\: array\\} but returns array\\.$#" - count: 1 - path: ../src/Composer/Util/StreamContextFactory.php - - message: "#^Only booleans are allowed in a ternary operator condition, string\\|false given\\.$#" count: 1 @@ -5209,7 +5204,7 @@ parameters: path: ../src/Composer/Util/StreamContextFactory.php - - message: "#^Cannot access offset 'user' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#" + message: "#^Cannot access offset 'user' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int\\<0, 65535\\>, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#" count: 1 path: ../src/Composer/Util/Svn.php @@ -5304,7 +5299,7 @@ parameters: path: ../src/Composer/Util/TlsHelper.php - - message: "#^Only booleans are allowed in an if condition, int\\|false\\|null given\\.$#" + message: "#^Only booleans are allowed in an if condition, int\\<0, 65535\\>\\|false\\|null given\\.$#" count: 1 path: ../src/Composer/Util/Url.php @@ -5343,6 +5338,11 @@ parameters: count: 1 path: ../tests/Composer/Test/AllFunctionalTest.php + - + message: "#^Method Composer\\\\Test\\\\AllFunctionalTest\\:\\:cleanOutput\\(\\) should return string but returns string\\|false\\.$#" + count: 1 + path: ../tests/Composer/Test/AllFunctionalTest.php + - message: "#^Only booleans are allowed in an if condition, string\\|false given\\.$#" count: 1 @@ -5363,6 +5363,11 @@ parameters: count: 3 path: ../tests/Composer/Test/AllFunctionalTest.php + - + message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|false given\\.$#" + count: 1 + path: ../tests/Composer/Test/AllFunctionalTest.php + - message: "#^Parameter \\#2 \\$subject of static method Composer\\\\Pcre\\\\Preg\\:\\:split\\(\\) expects string, string\\|false given\\.$#" count: 1 @@ -5428,11 +5433,6 @@ parameters: count: 1 path: ../tests/Composer/Test/DependencyResolver/PoolBuilderTest.php - - - message: "#^Only booleans are allowed in &&, mixed given on the right side\\.$#" - count: 2 - path: ../tests/Composer/Test/DependencyResolver/PoolBuilderTest.php - - message: "#^Only booleans are allowed in an if condition, int\\|false given\\.$#" count: 2 @@ -6046,11 +6046,6 @@ parameters: count: 1 path: ../tests/Composer/Test/Util/TlsHelperTest.php - - - message: "#^Offset 'san' does not exist on array\\{cn\\: string, san\\: array\\\\}\\|null\\.$#" - count: 1 - path: ../tests/Composer/Test/Util/TlsHelperTest.php - - message: "#^Only booleans are allowed in a ternary operator condition, array\\ given\\.$#" count: 1 diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 2a20265df..e57e26920 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -1109,9 +1109,10 @@ HEADER; } foreach ((array) $loader as $prop => $value) { - if ($value && 0 === strpos($prop, $prefix)) { - $maps[substr($prop, $prefixLen)] = $value; + if (!is_array($value) || \count($value) === 0 || !str_starts_with($prop, $prefix)) { + continue; } + $maps[substr($prop, $prefixLen)] = $value; } foreach ($maps as $prop => $value) {