Update phpstan & baseline (2158, 104)

main
Jordi Boggiano 2 years ago
parent 854aab5f03
commit 6bd75d5738
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

47
composer.lock generated

@ -1824,20 +1824,20 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.4.10", "version": "1.5.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "898c479c39caa727bedf4311dd294a8f4e250e72" "reference": "f32e95f571c9587b4e14be05253ae56fedd00b2c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/898c479c39caa727bedf4311dd294a8f4e250e72", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f32e95f571c9587b4e14be05253ae56fedd00b2c",
"reference": "898c479c39caa727bedf4311dd294a8f4e250e72", "reference": "f32e95f571c9587b4e14be05253ae56fedd00b2c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.1|^8.0" "php": "^7.2|^8.0"
}, },
"conflict": { "conflict": {
"phpstan/phpstan-shim": "*" "phpstan/phpstan-shim": "*"
@ -1859,7 +1859,7 @@
"description": "PHPStan - PHP Static Analysis Tool", "description": "PHPStan - PHP Static Analysis Tool",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan/issues", "issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.4.10" "source": "https://github.com/phpstan/phpstan/tree/1.5.2"
}, },
"funding": [ "funding": [
{ {
@ -1879,7 +1879,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-03-14T10:25:45+00:00" "time": "2022-03-29T07:34:36+00:00"
}, },
{ {
"name": "phpstan/phpstan-deprecation-rules", "name": "phpstan/phpstan-deprecation-rules",
@ -1933,21 +1933,21 @@
}, },
{ {
"name": "phpstan/phpstan-phpunit", "name": "phpstan/phpstan-phpunit",
"version": "1.0.0", "version": "1.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-phpunit.git", "url": "https://github.com/phpstan/phpstan-phpunit.git",
"reference": "9eb88c9f689003a8a2a5ae9e010338ee94dc39b3" "reference": "09133ce914f1388a8bb8c7f8573aaa3723cff52a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/9eb88c9f689003a8a2a5ae9e010338ee94dc39b3", "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/09133ce914f1388a8bb8c7f8573aaa3723cff52a",
"reference": "9eb88c9f689003a8a2a5ae9e010338ee94dc39b3", "reference": "09133ce914f1388a8bb8c7f8573aaa3723cff52a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.1 || ^8.0", "php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.0" "phpstan/phpstan": "^1.5.0"
}, },
"conflict": { "conflict": {
"phpunit/phpunit": "<7.0" "phpunit/phpunit": "<7.0"
@ -1960,9 +1960,6 @@
}, },
"type": "phpstan-extension", "type": "phpstan-extension",
"extra": { "extra": {
"branch-alias": {
"dev-master": "1.0-dev"
},
"phpstan": { "phpstan": {
"includes": [ "includes": [
"extension.neon", "extension.neon",
@ -1982,9 +1979,9 @@
"description": "PHPUnit extensions and rules for PHPStan", "description": "PHPUnit extensions and rules for PHPStan",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan-phpunit/issues", "issues": "https://github.com/phpstan/phpstan-phpunit/issues",
"source": "https://github.com/phpstan/phpstan-phpunit/tree/1.0.0" "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.1.0"
}, },
"time": "2021-10-14T08:03:54+00:00" "time": "2022-03-28T09:20:49+00:00"
}, },
{ {
"name": "phpstan/phpstan-strict-rules", "name": "phpstan/phpstan-strict-rules",
@ -2039,16 +2036,16 @@
}, },
{ {
"name": "phpstan/phpstan-symfony", "name": "phpstan/phpstan-symfony",
"version": "1.1.7", "version": "1.1.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-symfony.git", "url": "https://github.com/phpstan/phpstan-symfony.git",
"reference": "8ef80f5c4f70ebd31a55647bc082ea9df4bf0132" "reference": "4bdffcf1033b6c60662a28419d0192e0dda5684f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/8ef80f5c4f70ebd31a55647bc082ea9df4bf0132", "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/4bdffcf1033b6c60662a28419d0192e0dda5684f",
"reference": "8ef80f5c4f70ebd31a55647bc082ea9df4bf0132", "reference": "4bdffcf1033b6c60662a28419d0192e0dda5684f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2107,9 +2104,9 @@
"description": "Symfony Framework extensions and rules for PHPStan", "description": "Symfony Framework extensions and rules for PHPStan",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan-symfony/issues", "issues": "https://github.com/phpstan/phpstan-symfony/issues",
"source": "https://github.com/phpstan/phpstan-symfony/tree/1.1.7" "source": "https://github.com/phpstan/phpstan-symfony/tree/1.1.8"
}, },
"time": "2022-02-25T19:36:13+00:00" "time": "2022-03-24T07:56:03+00:00"
}, },
{ {
"name": "symfony/phpunit-bridge", "name": "symfony/phpunit-bridge",
@ -2207,5 +2204,5 @@
"platform-overrides": { "platform-overrides": {
"php": "7.2.5" "php": "7.2.5"
}, },
"plugin-api-version": "2.2.0" "plugin-api-version": "2.3.0"
} }

@ -780,11 +780,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/Command/RemoveCommand.php path: ../src/Composer/Command/RemoveCommand.php
-
message: "#^Only booleans are allowed in &&, array\\<string\\> given on the right side\\.$#"
count: 2
path: ../src/Composer/Command/RemoveCommand.php
- -
message: "#^Only booleans are allowed in an if condition, Composer\\\\Composer\\|null given\\.$#" message: "#^Only booleans are allowed in an if condition, Composer\\\\Composer\\|null given\\.$#"
count: 1 count: 1
@ -800,11 +795,6 @@ parameters:
count: 3 count: 3
path: ../src/Composer/Command/RemoveCommand.php path: ../src/Composer/Command/RemoveCommand.php
-
message: "#^Parameter \\#2 \\$array of static method Composer\\\\Pcre\\\\Preg\\:\\:grep\\(\\) expects array\\<string\\>, array\\<int, int\\|string\\> given\\.$#"
count: 2
path: ../src/Composer/Command/RemoveCommand.php
- -
message: "#^Cannot call method getRepoName\\(\\) on Composer\\\\Repository\\\\RepositoryInterface\\|null\\.$#" message: "#^Cannot call method getRepoName\\(\\) on Composer\\\\Repository\\\\RepositoryInterface\\|null\\.$#"
count: 4 count: 4
@ -1815,16 +1805,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/DependencyResolver/Request.php path: ../src/Composer/DependencyResolver/Request.php
-
message: "#^Binary operation \"\\.\" between array\\{package\\: Composer\\\\Package\\\\BasePackage\\}\\|array\\{packageName\\: string, constraint\\: Composer\\\\Semver\\\\Constraint\\\\ConstraintInterface\\}\\|Composer\\\\Package\\\\BasePackage\\|Composer\\\\Package\\\\Link\\|int\\|string and ' and thus cannot…' results in an error\\.$#"
count: 1
path: ../src/Composer/DependencyResolver/Rule.php
-
message: "#^Binary operation \"\\.\" between literal\\-string&non\\-empty\\-string and array\\{package\\: Composer\\\\Package\\\\BasePackage\\}\\|array\\{packageName\\: string, constraint\\: Composer\\\\Semver\\\\Constraint\\\\ConstraintInterface\\}\\|Composer\\\\Package\\\\BasePackage\\|Composer\\\\Package\\\\Link\\|int\\|string results in an error\\.$#"
count: 1
path: ../src/Composer/DependencyResolver/Rule.php
- -
message: "#^Cannot access offset 'constraint' on array\\{package\\: Composer\\\\Package\\\\BasePackage\\}\\|array\\{packageName\\: string, constraint\\: Composer\\\\Semver\\\\Constraint\\\\ConstraintInterface\\}\\|Composer\\\\Package\\\\BasePackage\\|Composer\\\\Package\\\\Link\\|int\\|string\\.$#" message: "#^Cannot access offset 'constraint' on array\\{package\\: Composer\\\\Package\\\\BasePackage\\}\\|array\\{packageName\\: string, constraint\\: Composer\\\\Semver\\\\Constraint\\\\ConstraintInterface\\}\\|Composer\\\\Package\\\\BasePackage\\|Composer\\\\Package\\\\Link\\|int\\|string\\.$#"
count: 2 count: 2
@ -1905,11 +1885,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/DependencyResolver/Rule.php path: ../src/Composer/DependencyResolver/Rule.php
-
message: "#^Possibly invalid array key type array\\<string, Composer\\\\Package\\\\BasePackage\\|Composer\\\\Semver\\\\Constraint\\\\ConstraintInterface\\|string\\>\\|Composer\\\\Package\\\\BasePackage\\|Composer\\\\Package\\\\Link\\|int\\|string\\.$#"
count: 2
path: ../src/Composer/DependencyResolver/Rule.php
- -
message: "#^Method Composer\\\\DependencyResolver\\\\RuleSet\\:\\:getTypes\\(\\) should return array\\{0, 1, 4\\} but returns array\\<int, 0\\|1\\|4\\>\\.$#" message: "#^Method Composer\\\\DependencyResolver\\\\RuleSet\\:\\:getTypes\\(\\) should return array\\{0, 1, 4\\} but returns array\\<int, 0\\|1\\|4\\>\\.$#"
count: 1 count: 1
@ -5168,26 +5143,11 @@ parameters:
count: 2 count: 2
path: ../src/Composer/Util/Http/CurlDownloader.php path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Only booleans are allowed in &&, Composer\\\\Util\\\\Http\\\\CurlResponse\\|null given on the right side\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Only booleans are allowed in &&, array\\<int, string\\>\\|null given on the right side\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
- -
message: "#^Only booleans are allowed in &&, int given on the right side\\.$#" message: "#^Only booleans are allowed in &&, int given on the right side\\.$#"
count: 2 count: 2
path: ../src/Composer/Util/Http/CurlDownloader.php path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Only booleans are allowed in &&, mixed given on the right side\\.$#"
count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php
- -
message: "#^Only booleans are allowed in a negated boolean, resource\\|false given\\.$#" message: "#^Only booleans are allowed in a negated boolean, resource\\|false given\\.$#"
count: 1 count: 1
@ -5830,7 +5790,7 @@ parameters:
- -
message: "#^Parameter \\#1 \\$str of static method Composer\\\\Util\\\\Platform\\:\\:strlen\\(\\) expects string, string\\|false given\\.$#" message: "#^Parameter \\#1 \\$str of static method Composer\\\\Util\\\\Platform\\:\\:strlen\\(\\) expects string, string\\|false given\\.$#"
count: 5 count: 3
path: ../src/Composer/Util/RemoteFilesystem.php path: ../src/Composer/Util/RemoteFilesystem.php
- -
@ -6696,11 +6656,6 @@ parameters:
count: 1 count: 1
path: ../tests/Composer/Test/Repository/PathRepositoryTest.php path: ../tests/Composer/Test/Repository/PathRepositoryTest.php
-
message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, array\\<string, array\\<int, array\\|string\\>\\>\\|false given\\.$#"
count: 1
path: ../tests/Composer/Test/Repository/PlatformRepositoryTest.php
- -
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Composer\\\\\\\\Repository…' and Composer\\\\Repository\\\\FilterRepository will always evaluate to true\\.$#" message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Composer\\\\\\\\Repository…' and Composer\\\\Repository\\\\FilterRepository will always evaluate to true\\.$#"
count: 1 count: 1

@ -134,6 +134,7 @@ EOT
$file = Factory::getComposerFile(); $file = Factory::getComposerFile();
$jsonFile = new JsonFile($file); $jsonFile = new JsonFile($file);
/** @var array{require?: array<string, string>, require-dev?: array<string, string>} $composer */
$composer = $jsonFile->read(); $composer = $jsonFile->read();
$composerBackup = file_get_contents($jsonFile->getPath()); $composerBackup = file_get_contents($jsonFile->getPath());
@ -176,7 +177,7 @@ EOT
} }
} }
} }
} elseif (isset($composer[$type]) && $matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) { } elseif (isset($composer[$type]) && count($matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) > 0) {
foreach ($matches as $matchedPackage) { foreach ($matches as $matchedPackage) {
if ($dryRun) { if ($dryRun) {
$toRemove[$type][] = $matchedPackage; $toRemove[$type][] = $matchedPackage;
@ -184,7 +185,7 @@ EOT
$json->removeLink($type, $matchedPackage); $json->removeLink($type, $matchedPackage);
} }
} }
} elseif (isset($composer[$altType]) && $matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) { } elseif (isset($composer[$altType]) && count($matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) > 0) {
foreach ($matches as $matchedPackage) { foreach ($matches as $matchedPackage) {
$io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>'); $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
if ($io->isInteractive()) { if ($io->isInteractive()) {

@ -373,6 +373,7 @@ abstract class Rule
$package = $pool->literalToPackage($literal); $package = $pool->literalToPackage($literal);
$packageNames[$package->getName()] = true; $packageNames[$package->getName()] = true;
} }
/** @var string $replacedName */
$replacedName = $this->reasonData; $replacedName = $this->reasonData;
if (count($packageNames) > 1) { if (count($packageNames) > 1) {

@ -333,6 +333,9 @@ class CurlDownloader
} }
$progress = curl_getinfo($curlHandle); $progress = curl_getinfo($curlHandle);
if (false === $progress) {
throw new \RuntimeException('Failed getting info from curl handle '.$i.' ('.$this->jobs[$i]['url'].')');
}
$job = $this->jobs[$i]; $job = $this->jobs[$i];
unset($this->jobs[$i]); unset($this->jobs[$i]);
$error = curl_error($curlHandle); $error = curl_error($curlHandle);
@ -364,7 +367,7 @@ class CurlDownloader
continue; continue;
} }
if ($errno === 28 /* CURLE_OPERATION_TIMEDOUT */ && isset($progress['namelookup_time']) && $progress['namelookup_time'] == 0 && !$timeoutWarning) { if ($errno === 28 /* CURLE_OPERATION_TIMEDOUT */ && PHP_VERSION_ID >= 70300 && $progress['namelookup_time'] == 0 && !$timeoutWarning) {
$timeoutWarning = true; $timeoutWarning = true;
$this->io->writeError('<warning>A connection timeout was encountered. If you intend to run Composer without connecting to the internet, run the command again prefixed with COMPOSER_DISABLE_NETWORK=1 to make Composer run in offline mode.</warning>'); $this->io->writeError('<warning>A connection timeout was encountered. If you intend to run Composer without connecting to the internet, run the command again prefixed with COMPOSER_DISABLE_NETWORK=1 to make Composer run in offline mode.</warning>');
} }
@ -443,14 +446,14 @@ class CurlDownloader
call_user_func($job['resolve'], $response); call_user_func($job['resolve'], $response);
} }
} catch (\Exception $e) { } catch (\Exception $e) {
if ($e instanceof TransportException && $headers) { if ($e instanceof TransportException) {
$e->setHeaders($headers); if (null !== $headers) {
$e->setStatusCode($statusCode); $e->setHeaders($headers);
} $e->setStatusCode($statusCode);
if ($e instanceof TransportException && $response) { }
$e->setResponse($response->getBody()); if (null !== $response) {
} $e->setResponse($response->getBody());
if ($e instanceof TransportException && $progress) { }
$e->setResponseInfo($progress); $e->setResponseInfo($progress);
} }

@ -1078,7 +1078,7 @@ Linked Version => 1.2.11',
* *
* @param string|string[] $extensions * @param string|string[] $extensions
* @param string|null $info * @param string|null $info
* @param array<string,string|false> $expectations * @param array<string,string|false|array{string|false, 1?: string[], 2?: string[]}> $expectations array of packageName => expected version (or false if expected to be msising), or packageName => array(expected version, expected replaced names, expected provided names)
* @param list<mixed> $functions * @param list<mixed> $functions
* @param list<mixed> $constants * @param list<mixed> $constants
* @param list<mixed> $classDefinitions * @param list<mixed> $classDefinitions
@ -1153,10 +1153,6 @@ Linked Version => 1.2.11',
$platformRepository = new PlatformRepository(array(), array(), $runtime); $platformRepository = new PlatformRepository(array(), array(), $runtime);
$expectations = array_map(function ($expectation): array {
return array_replace(array(null, array(), array()), (array) $expectation);
}, $expectations);
$libraries = array_map( $libraries = array_map(
function ($package): string { function ($package): string {
return $package['name']; return $package['name'];
@ -1168,17 +1164,21 @@ Linked Version => 1.2.11',
} }
) )
); );
$expectedLibraries = array_merge(array_keys(array_filter($expectations, function ($expectation): bool { $expectedLibraries = array_keys(array_filter($expectations, function ($expectation): bool {
return $expectation[0] !== false; return $expectation !== false;
}))); }));
self::assertCount(count(array_filter($expectedLibraries)), $libraries, sprintf('Expected: %s, got %s', var_export($expectedLibraries, true), var_export($libraries, true))); self::assertCount(count(array_filter($expectedLibraries)), $libraries, sprintf('Expected: %s, got %s', var_export($expectedLibraries, true), var_export($libraries, true)));
$expectations = array_merge($expectations, array_combine(array_map(function ($extension): string { foreach ($extensions as $extension) {
return 'ext-'.$extension; $expectations['ext-'.$extension] = $extensionVersion;
}, $extensions), array_fill(0, count($extensions), array($extensionVersion, array(), array())))); }
foreach ($expectations as $packageName => $expectation) { foreach ($expectations as $expectedLibOrExt => $expectation) {
list($expectedVersion, $expectedReplaces, $expectedProvides) = $expectation; $packageName = $expectedLibOrExt;
if (!is_array($expectation)) {
$expectation = [$expectation, [], []];
}
list($expectedVersion, $expectedReplaces, $expectedProvides) = array_pad($expectation, 3, []);
$package = $platformRepository->findPackage($packageName, '*'); $package = $platformRepository->findPackage($packageName, '*');
if ($expectedVersion === false) { if ($expectedVersion === false) {

Loading…
Cancel
Save