diff --git a/composer.json b/composer.json index a6a5fe618..5249c9ebe 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ }, "require-dev": { "symfony/phpunit-bridge": "^6.0", - "phpstan/phpstan": "^1.3.3", + "phpstan/phpstan": "^1.4.0", "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-deprecation-rules": "^1", "phpstan/phpstan-strict-rules": "^1" diff --git a/composer.lock b/composer.lock index efb4a4d3e..eaf7eec2c 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": "90beb24e77fae0c4a6a983be929e0d23", + "content-hash": "cb27eeddb876abfa8b15747d9fc568f0", "packages": [ { "name": "composer/ca-bundle", @@ -1798,16 +1798,16 @@ "packages-dev": [ { "name": "phpstan/phpstan", - "version": "1.3.3", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "151a51f6149855785fbd883e79768c0abc96b75f" + "reference": "72b04d97b5e6e60a081f17c416fef35bd521120b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/151a51f6149855785fbd883e79768c0abc96b75f", - "reference": "151a51f6149855785fbd883e79768c0abc96b75f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/72b04d97b5e6e60a081f17c416fef35bd521120b", + "reference": "72b04d97b5e6e60a081f17c416fef35bd521120b", "shasum": "" }, "require": { @@ -1823,7 +1823,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -1838,7 +1838,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.3.3" + "source": "https://github.com/phpstan/phpstan/tree/1.4.0" }, "funding": [ { @@ -1858,7 +1858,7 @@ "type": "tidelift" } ], - "time": "2022-01-07T09:49:03+00:00" + "time": "2022-01-14T15:58:47+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", diff --git a/phpstan/baseline-8.1.neon b/phpstan/baseline-8.1.neon index 657c6b34b..4766c40fe 100644 --- a/phpstan/baseline-8.1.neon +++ b/phpstan/baseline-8.1.neon @@ -270,11 +270,6 @@ parameters: count: 2 path: ../src/Composer/Util/Hg.php - - - message: "#^Array \\(array\\\\) does not accept array\\{url\\: string, origin\\: string, attributes\\: non\\-empty\\-array\\, options\\: array, progress\\: array, curlHandle\\: CurlHandle, filename\\: string\\|null, headerHandle\\: resource\\|false, \\.\\.\\.\\}\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - message: "#^Parameter \\#1 \\$handle of function curl_close expects CurlHandle, resource given\\.$#" count: 1 @@ -330,6 +325,11 @@ parameters: count: 1 path: ../src/Composer/Util/Http/CurlDownloader.php + - + message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$jobs \\(array\\\\) does not accept non\\-empty\\-array\\, options\\: array, progress\\: array, curlHandle\\: CurlHandle\\|resource, filename\\: string\\|false\\|null, headerHandle\\: resource\\|false, \\.\\.\\.\\}\\>\\.$#" + count: 1 + path: ../src/Composer/Util/Http/CurlDownloader.php + - message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$multiHandle \\(resource\\|null\\) does not accept CurlMultiHandle\\.$#" count: 1 diff --git a/phpstan/baseline.neon b/phpstan/baseline.neon index 0865c36c7..2456e9131 100644 --- a/phpstan/baseline.neon +++ b/phpstan/baseline.neon @@ -1,10 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Argument of an invalid type array\\\\|string supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: ../src/Composer/Autoload/AutoloadGenerator.php - - message: "#^Binary operation \"\\.\" between non\\-empty\\-string and array\\|string\\|null results in an error\\.$#" count: 1 @@ -110,11 +105,6 @@ parameters: count: 3 path: ../src/Composer/Autoload/AutoloadGenerator.php - - - message: "#^Parameter \\#1 \\$files of method Composer\\\\Autoload\\\\AutoloadGenerator\\:\\:getIncludeFilesFile\\(\\) expects array\\, array\\\\|string\\> given\\.$#" - count: 1 - path: ../src/Composer/Autoload/AutoloadGenerator.php - - message: "#^Parameter \\#1 \\$from of method Composer\\\\Util\\\\Filesystem\\:\\:findShortestPathCode\\(\\) expects string, string\\|false given\\.$#" count: 5 @@ -165,11 +155,6 @@ parameters: count: 1 path: ../src/Composer/Autoload/AutoloadGenerator.php - - - message: "#^Parameter \\#6 \\$namespaceFilter of method Composer\\\\Autoload\\\\AutoloadGenerator\\:\\:addClassMapCode\\(\\) expects string\\|null, int\\|string given\\.$#" - count: 1 - path: ../src/Composer/Autoload/AutoloadGenerator.php - - message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#" count: 2 @@ -1135,6 +1120,11 @@ parameters: count: 1 path: ../src/Composer/Command/InitCommand.php + - + message: "#^Property Composer\\\\Command\\\\InitCommand\\:\\:\\$gitConfig \\(array\\\\) does not accept array\\\\.$#" + count: 1 + path: ../src/Composer/Command/InitCommand.php + - message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#" count: 15 @@ -2405,11 +2395,6 @@ parameters: count: 1 path: ../src/Composer/Compiler.php - - - message: "#^Array \\(array\\\\) does not accept key 0\\|string\\.$#" - count: 1 - path: ../src/Composer/Config.php - - message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#" count: 1 @@ -2465,6 +2450,11 @@ parameters: count: 1 path: ../src/Composer/Config.php + - + message: "#^Property Composer\\\\Config\\:\\:\\$warnedHosts \\(array\\\\) does not accept non\\-empty\\-array\\<0\\|string, true\\>\\.$#" + 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: 2 @@ -2915,11 +2905,6 @@ parameters: count: 2 path: ../src/Composer/DependencyResolver/Rule.php - - - message: "#^Array \\(array\\\\|Composer\\\\DependencyResolver\\\\Rule\\>\\) does not accept key int\\|string\\.$#" - count: 2 - path: ../src/Composer/DependencyResolver/RuleSet.php - - message: "#^Method Composer\\\\DependencyResolver\\\\RuleSet\\:\\:getTypes\\(\\) should return array\\{0, 1, 4\\} but returns array\\\\.$#" count: 1 @@ -2940,6 +2925,11 @@ parameters: count: 1 path: ../src/Composer/DependencyResolver/RuleSet.php + - + message: "#^Property Composer\\\\DependencyResolver\\\\RuleSet\\:\\:\\$rulesByHash \\(array\\\\|Composer\\\\DependencyResolver\\\\Rule\\>\\) does not accept array\\\\|Composer\\\\DependencyResolver\\\\Rule\\>\\.$#" + count: 3 + path: ../src/Composer/DependencyResolver/RuleSet.php + - message: "#^Only booleans are allowed in a negated boolean, Composer\\\\DependencyResolver\\\\Rule\\|null given\\.$#" count: 1 @@ -3011,7 +3001,7 @@ parameters: path: ../src/Composer/DependencyResolver/Solver.php - - message: "#^Only booleans are allowed in &&, int given on the left side\\.$#" + message: "#^Only booleans are allowed in &&, int\\<0, max\\> given on the left side\\.$#" count: 1 path: ../src/Composer/DependencyResolver/Solver.php @@ -3037,7 +3027,12 @@ parameters: - message: "#^Only booleans are allowed in a negated boolean, int given\\.$#" - count: 3 + count: 2 + path: ../src/Composer/DependencyResolver/Solver.php + + - + message: "#^Only booleans are allowed in a negated boolean, int\\<0, max\\> given\\.$#" + count: 1 path: ../src/Composer/DependencyResolver/Solver.php - @@ -3871,12 +3866,12 @@ parameters: path: ../src/Composer/Factory.php - - message: "#^Array \\(array\\\\) does not accept array\\{username\\: string, password\\: string\\|null\\}\\.$#" + message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" count: 1 path: ../src/Composer/IO/BaseIO.php - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" + message: "#^Property Composer\\\\IO\\\\BaseIO\\:\\:\\$authentications \\(array\\\\) does not accept non\\-empty\\-array\\\\.$#" count: 1 path: ../src/Composer/IO/BaseIO.php @@ -3940,11 +3935,6 @@ parameters: count: 1 path: ../src/Composer/IO/ConsoleIO.php - - - message: "#^Array \\(array\\\\|bool\\|string\\>\\|bool\\|string\\>\\>\\>\\) does not accept key \\(int\\|string\\)\\.$#" - count: 1 - path: ../src/Composer/InstalledVersions.php - - message: "#^Call to function method_exists\\(\\) with 'Composer\\\\\\\\Autoload…' and 'getRegisteredLoaders' will always evaluate to true\\.$#" count: 1 @@ -3975,11 +3965,6 @@ parameters: count: 15 path: ../src/Composer/Installer.php - - - message: "#^Method Composer\\\\Installer\\:\\:run\\(\\) should return 0\\|1\\|2\\|3\\|4 but returns int\\\\|int\\<1, max\\>\\.$#" - count: 1 - path: ../src/Composer/Installer.php - - message: "#^Only booleans are allowed in &&, array\\\\> given on the right side\\.$#" count: 1 @@ -4041,7 +4026,7 @@ parameters: path: ../src/Composer/Installer.php - - message: "#^Only booleans are allowed in an if condition, int given\\.$#" + message: "#^Only booleans are allowed in an if condition, int\\<0, max\\> given\\.$#" count: 1 path: ../src/Composer/Installer.php @@ -4336,7 +4321,7 @@ parameters: path: ../src/Composer/Json/JsonFile.php - - message: "#^Only booleans are allowed in an if condition, int given\\.$#" + message: "#^Only booleans are allowed in an if condition, int\\ given\\.$#" count: 1 path: ../src/Composer/Json/JsonFile.php @@ -4491,7 +4476,7 @@ parameters: path: ../src/Composer/Package/BasePackage.php - - message: "#^Method Composer\\\\Package\\\\Comparer\\\\Comparer\\:\\:getChanged\\(\\) should return array\\{changed\\?\\: array\\, removed\\?\\: array\\, added\\?\\: array\\\\}\\|string\\|false but returns \\(non\\-empty\\-array\\\\>\\)\\|string\\.$#" + message: "#^Offset 'string' does not exist on array\\{added\\?\\: array\\, changed\\?\\: array\\, removed\\?\\: array\\, string\\?\\: non\\-empty\\-array\\\\}\\.$#" count: 1 path: ../src/Composer/Package/Comparer/Comparer.php @@ -4975,11 +4960,6 @@ parameters: count: 1 path: ../src/Composer/Platform/Runtime.php - - - message: "#^Array \\(array\\\\) does not accept object\\.$#" - count: 2 - path: ../src/Composer/Plugin/PluginManager.php - - message: "#^Cannot call method getInstallationManager\\(\\) on Composer\\\\Composer\\|null\\.$#" count: 1 @@ -5075,6 +5055,11 @@ parameters: count: 1 path: ../src/Composer/Plugin/PluginManager.php + - + message: "#^Property Composer\\\\Plugin\\\\PluginManager\\:\\:\\$registeredPlugins \\(array\\\\) does not accept array\\\\.$#" + count: 2 + path: ../src/Composer/Plugin/PluginManager.php + - message: "#^Property Composer\\\\Plugin\\\\PostFileDownloadEvent\\:\\:\\$fileName \\(string\\) does not accept string\\|null\\.$#" count: 1 @@ -5115,6 +5100,11 @@ parameters: count: 1 path: ../src/Composer/Repository/ArrayRepository.php + - + message: "#^Property Composer\\\\Repository\\\\ArrayRepository\\:\\:\\$packages \\(array\\\\|null\\) does not accept array\\\\.$#" + count: 1 + path: ../src/Composer/Repository/ArrayRepository.php + - message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#" count: 1 @@ -5276,7 +5266,7 @@ parameters: path: ../src/Composer/Repository/ComposerRepository.php - - message: "#^Only booleans are allowed in an if condition, int given\\.$#" + message: "#^Only booleans are allowed in an if condition, int\\ given\\.$#" count: 1 path: ../src/Composer/Repository/ComposerRepository.php @@ -5315,6 +5305,11 @@ parameters: count: 1 path: ../src/Composer/Repository/ComposerRepository.php + - + message: "#^Property Composer\\\\Repository\\\\ComposerRepository\\:\\:\\$partialPackagesByName \\(array\\\\|null\\) does not accept array\\\\|Composer\\\\Package\\\\PackageInterface\\>\\.$#" + count: 1 + path: ../src/Composer/Repository/ComposerRepository.php + - message: "#^Only booleans are allowed in a ternary operator condition, array\\\\> given\\.$#" count: 3 @@ -5780,6 +5775,11 @@ parameters: count: 1 path: ../src/Composer/Repository/Vcs/GitDriver.php + - + message: "#^Property Composer\\\\Repository\\\\Vcs\\\\GitDriver\\:\\:\\$tags \\(array\\\\) does not accept array\\\\.$#" + count: 1 + path: ../src/Composer/Repository/Vcs/GitDriver.php + - message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#" count: 2 @@ -5960,6 +5960,11 @@ parameters: count: 1 path: ../src/Composer/Repository/Vcs/GitLabDriver.php + - + message: "#^Property Composer\\\\Repository\\\\Vcs\\\\GitLabDriver\\:\\:\\$commits \\(array\\\\) does not accept array\\\\.$#" + count: 1 + path: ../src/Composer/Repository/Vcs/GitLabDriver.php + - message: "#^Property Composer\\\\Repository\\\\Vcs\\\\VcsDriver\\:\\:\\$originUrl \\(string\\) does not accept string\\|false\\.$#" count: 1 @@ -6565,11 +6570,6 @@ parameters: count: 2 path: ../src/Composer/Util/Hg.php - - - message: "#^Array \\(array\\\\) does not accept array\\{url\\: string, origin\\: string, attributes\\: non\\-empty\\-array\\, options\\: array, progress\\: array, curlHandle\\: resource, filename\\: string\\|null, headerHandle\\: resource\\|false, \\.\\.\\.\\}\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" count: 1 @@ -6770,6 +6770,11 @@ parameters: count: 1 path: ../src/Composer/Util/Http/CurlDownloader.php + - + message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$jobs \\(array\\\\) does not accept non\\-empty\\-array\\, options\\: array, progress\\: array, curlHandle\\: resource, filename\\: string\\|false\\|null, headerHandle\\: resource\\|false, \\.\\.\\.\\}\\>\\.$#" + count: 1 + path: ../src/Composer/Util/Http/CurlDownloader.php + - message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$multiHandle \\(resource\\|null\\) does not accept resource\\|false\\.$#" count: 1 @@ -6996,7 +7001,7 @@ parameters: path: ../src/Composer/Util/Loop.php - - message: "#^Cannot access offset int\\ on array\\|false\\.$#" + message: "#^Cannot access offset int\\<1, 16\\> on array\\|false\\.$#" count: 6 path: ../src/Composer/Util/NoProxyPattern.php @@ -7175,6 +7180,11 @@ parameters: count: 1 path: ../src/Composer/Util/ProcessExecutor.php + - + message: "#^Property Composer\\\\Util\\\\ProcessExecutor\\:\\:\\$jobs \\(array\\\\>\\) does not accept array\\\\>\\.$#" + count: 1 + path: ../src/Composer/Util/ProcessExecutor.php + - message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#" count: 1 @@ -7400,6 +7410,36 @@ parameters: count: 1 path: ../src/Composer/Util/Svn.php + - + message: "#^Property Composer\\\\Util\\\\Svn\\:\\:\\$credentials \\(array\\{username\\: string, password\\: string\\}\\|null\\) does not accept array\\{username\\: mixed, password\\?\\: string\\}\\.$#" + count: 1 + path: ../src/Composer/Util/Svn.php + + - + message: "#^Property Composer\\\\Util\\\\Svn\\:\\:\\$credentials \\(array\\{username\\: string, password\\: string\\}\\|null\\) does not accept array\\{username\\: non\\-empty\\-string, password\\?\\: string\\}\\.$#" + count: 1 + path: ../src/Composer/Util/Svn.php + + - + message: "#^Property Composer\\\\Util\\\\Svn\\:\\:\\$credentials \\(array\\{username\\: string, password\\: string\\}\\|null\\) does not accept array\\{username\\: string\\|null, password\\?\\: string\\}\\.$#" + count: 1 + path: ../src/Composer/Util/Svn.php + + - + message: "#^Property Composer\\\\Util\\\\Svn\\:\\:\\$credentials \\(array\\{username\\: string, password\\: string\\}\\|null\\) does not accept array\\{username\\?\\: string, password\\: mixed\\}\\.$#" + count: 1 + path: ../src/Composer/Util/Svn.php + + - + message: "#^Property Composer\\\\Util\\\\Svn\\:\\:\\$credentials \\(array\\{username\\: string, password\\: string\\}\\|null\\) does not accept array\\{username\\?\\: string, password\\: string\\|null\\}\\.$#" + count: 1 + path: ../src/Composer/Util/Svn.php + + - + message: "#^Property Composer\\\\Util\\\\Svn\\:\\:\\$credentials \\(array\\{username\\: string, password\\: string\\}\\|null\\) does not accept array\\{username\\?\\: string, password\\: string\\}\\.$#" + count: 1 + path: ../src/Composer/Util/Svn.php + - message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#" count: 1 @@ -8278,11 +8318,6 @@ parameters: count: 1 path: ../tests/Composer/Test/Platform/VersionTest.php - - - message: "#^Array \\(array\\\\) does not accept Composer\\\\Package\\\\CompleteAliasPackage\\|Composer\\\\Package\\\\CompletePackage\\.$#" - count: 1 - path: ../tests/Composer/Test/Plugin/PluginInstallerTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Composer\\\\\\\\Command…' and Composer\\\\Command\\\\BaseCommand will always evaluate to true\\.$#" count: 1 @@ -8313,6 +8348,11 @@ parameters: count: 2 path: ../tests/Composer/Test/Plugin/PluginInstallerTest.php + - + message: "#^Property Composer\\\\Test\\\\Plugin\\\\PluginInstallerTest\\:\\:\\$packages \\(array\\\\) does not accept array\\\\.$#" + count: 1 + path: ../tests/Composer/Test/Plugin/PluginInstallerTest.php + - message: "#^Unable to resolve the template type CapabilityClass in call to method Composer\\\\Plugin\\\\PluginManager\\:\\:getPluginCapability\\(\\)$#" count: 2