1
0
Fork 0

Update PHPStan (#11976)

* Update PHPStan

* Update inline ignores to `@phpstan-ignore` with error identifier
pull/11962/merge
Ondřej Mirtes 2024-05-22 09:09:04 +02:00 committed by GitHub
parent d4b071bd1e
commit 5bb30ca170
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 84 additions and 85 deletions

View File

@ -46,11 +46,11 @@
}, },
"require-dev": { "require-dev": {
"symfony/phpunit-bridge": "^6.4.1 || ^7.0.1", "symfony/phpunit-bridge": "^6.4.1 || ^7.0.1",
"phpstan/phpstan": "^1.9.3", "phpstan/phpstan": "^1.11.0",
"phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-phpunit": "^1.4.0",
"phpstan/phpstan-deprecation-rules": "^1", "phpstan/phpstan-deprecation-rules": "^1.2.0",
"phpstan/phpstan-strict-rules": "^1", "phpstan/phpstan-strict-rules": "^1.6.0",
"phpstan/phpstan-symfony": "^1.2.10" "phpstan/phpstan-symfony": "^1.4.0"
}, },
"suggest": { "suggest": {
"ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages",

69
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "bbb9ffc97dcec54f38fdc5b4bf9a287d", "content-hash": "213c5ab8912ca04b1f7a77c008875ccc",
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
@ -2015,16 +2015,16 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.10.67", "version": "1.11.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493" "reference": "666cb1703742cea9cc80fee631f0940e1592fa6e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/16ddbe776f10da6a95ebd25de7c1dbed397dc493", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/666cb1703742cea9cc80fee631f0940e1592fa6e",
"reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493", "reference": "666cb1703742cea9cc80fee631f0940e1592fa6e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2069,29 +2069,28 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-04-16T07:22:02+00:00" "time": "2024-05-13T06:02:22+00:00"
}, },
{ {
"name": "phpstan/phpstan-deprecation-rules", "name": "phpstan/phpstan-deprecation-rules",
"version": "1.1.4", "version": "1.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-deprecation-rules.git", "url": "https://github.com/phpstan/phpstan-deprecation-rules.git",
"reference": "089d8a8258ed0aeefdc7b68b6c3d25572ebfdbaa" "reference": "fa8cce7720fa782899a0aa97b6a41225d1bb7b26"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/089d8a8258ed0aeefdc7b68b6c3d25572ebfdbaa", "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/fa8cce7720fa782899a0aa97b6a41225d1bb7b26",
"reference": "089d8a8258ed0aeefdc7b68b6c3d25572ebfdbaa", "reference": "fa8cce7720fa782899a0aa97b6a41225d1bb7b26",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2 || ^8.0", "php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.10.3" "phpstan/phpstan": "^1.11"
}, },
"require-dev": { "require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2", "php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-php-parser": "^1.1",
"phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5" "phpunit/phpunit": "^9.5"
}, },
@ -2115,27 +2114,27 @@
"description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues",
"source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.1.4" "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.2.0"
}, },
"time": "2023-08-05T09:02:04+00:00" "time": "2024-04-20T06:39:48+00:00"
}, },
{ {
"name": "phpstan/phpstan-phpunit", "name": "phpstan/phpstan-phpunit",
"version": "1.3.16", "version": "1.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-phpunit.git", "url": "https://github.com/phpstan/phpstan-phpunit.git",
"reference": "d5242a59d035e46774f2e634b374bc39ff62cb95" "reference": "f3ea021866f4263f07ca3636bf22c64be9610c11"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/d5242a59d035e46774f2e634b374bc39ff62cb95", "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/f3ea021866f4263f07ca3636bf22c64be9610c11",
"reference": "d5242a59d035e46774f2e634b374bc39ff62cb95", "reference": "f3ea021866f4263f07ca3636bf22c64be9610c11",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2 || ^8.0", "php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.10" "phpstan/phpstan": "^1.11"
}, },
"conflict": { "conflict": {
"phpunit/phpunit": "<7.0" "phpunit/phpunit": "<7.0"
@ -2167,27 +2166,27 @@
"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.3.16" "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.4.0"
}, },
"time": "2024-02-23T09:51:20+00:00" "time": "2024-04-20T06:39:00+00:00"
}, },
{ {
"name": "phpstan/phpstan-strict-rules", "name": "phpstan/phpstan-strict-rules",
"version": "1.5.5", "version": "1.6.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-strict-rules.git", "url": "https://github.com/phpstan/phpstan-strict-rules.git",
"reference": "2e193a07651a6f4be3baa44ddb21d822681f5918" "reference": "363f921dd8441777d4fc137deb99beb486c77df1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/2e193a07651a6f4be3baa44ddb21d822681f5918", "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/363f921dd8441777d4fc137deb99beb486c77df1",
"reference": "2e193a07651a6f4be3baa44ddb21d822681f5918", "reference": "363f921dd8441777d4fc137deb99beb486c77df1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2 || ^8.0", "php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.10.60" "phpstan/phpstan": "^1.11"
}, },
"require-dev": { "require-dev": {
"nikic/php-parser": "^4.13.0", "nikic/php-parser": "^4.13.0",
@ -2216,28 +2215,28 @@
"description": "Extra strict and opinionated rules for PHPStan", "description": "Extra strict and opinionated rules for PHPStan",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues", "issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.5.5" "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.6.0"
}, },
"time": "2024-04-19T15:12:26+00:00" "time": "2024-04-20T06:37:51+00:00"
}, },
{ {
"name": "phpstan/phpstan-symfony", "name": "phpstan/phpstan-symfony",
"version": "1.3.12", "version": "1.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-symfony.git", "url": "https://github.com/phpstan/phpstan-symfony.git",
"reference": "f4b9407fa3203aebafd422ae8f0eb1ef94659a80" "reference": "51183fefbaf4713aa81eddbd273dc59dd5e5ff71"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/f4b9407fa3203aebafd422ae8f0eb1ef94659a80", "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/51183fefbaf4713aa81eddbd273dc59dd5e5ff71",
"reference": "f4b9407fa3203aebafd422ae8f0eb1ef94659a80", "reference": "51183fefbaf4713aa81eddbd273dc59dd5e5ff71",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-simplexml": "*", "ext-simplexml": "*",
"php": "^7.2 || ^8.0", "php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.10.62" "phpstan/phpstan": "^1.11"
}, },
"conflict": { "conflict": {
"symfony/framework-bundle": "<3.0" "symfony/framework-bundle": "<3.0"
@ -2288,9 +2287,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.3.12" "source": "https://github.com/phpstan/phpstan-symfony/tree/1.4.0"
}, },
"time": "2024-04-14T13:30:23+00:00" "time": "2024-04-20T06:38:35+00:00"
}, },
{ {
"name": "symfony/phpunit-bridge", "name": "symfony/phpunit-bridge",

View File

@ -329,7 +329,7 @@ TAGSPUBKEY
// PHP 8 automatically frees the key instance and deprecates the function // PHP 8 automatically frees the key instance and deprecates the function
if (PHP_VERSION_ID < 80000) { if (PHP_VERSION_ID < 80000) {
// @phpstan-ignore-next-line // @phpstan-ignore function.deprecated
openssl_free_key($pubkeyid); openssl_free_key($pubkeyid);
} }

View File

@ -59,7 +59,7 @@ class InputArgument extends BaseInputArgument
public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
{ {
$values = $this->suggestedValues; $values = $this->suggestedValues;
if ($values instanceof \Closure && !\is_array($values = $values($input, $suggestions))) { // @phpstan-ignore-line if ($values instanceof \Closure && !\is_array($values = $values($input, $suggestions))) { // @phpstan-ignore function.impossibleType
throw new LogicException(sprintf('Closure for option "%s" must return an array. Got "%s".', $this->getName(), get_debug_type($values))); throw new LogicException(sprintf('Closure for option "%s" must return an array. Got "%s".', $this->getName(), get_debug_type($values)));
} }
if ([] !== $values) { if ([] !== $values) {

View File

@ -62,7 +62,7 @@ class InputOption extends BaseInputOption
public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
{ {
$values = $this->suggestedValues; $values = $this->suggestedValues;
if ($values instanceof \Closure && !\is_array($values = $values($input, $suggestions))) { // @phpstan-ignore-line if ($values instanceof \Closure && !\is_array($values = $values($input, $suggestions))) { // @phpstan-ignore function.impossibleType
throw new LogicException(sprintf('Closure for argument "%s" must return an array. Got "%s".', $this->getName(), get_debug_type($values))); throw new LogicException(sprintf('Closure for argument "%s" must return an array. Got "%s".', $this->getName(), get_debug_type($values)));
} }
if ([] !== $values) { if ([] !== $values) {

View File

@ -35,7 +35,7 @@ class ZipDownloader extends ArchiveDownloader
private static $isWindows; private static $isWindows;
/** @var ZipArchive|null */ /** @var ZipArchive|null */
private $zipArchiveObject; // @phpstan-ignore-line helper property that is set via reflection for testing purposes private $zipArchiveObject; // @phpstan-ignore property.onlyRead (helper property that is set via reflection for testing purposes)
/** /**
* @inheritDoc * @inheritDoc

View File

@ -539,7 +539,7 @@ class Installer
} }
// exists as of composer/semver 3.3.0 // exists as of composer/semver 3.3.0
if (method_exists('Composer\Semver\CompilingMatcher', 'clear')) { // @phpstan-ignore-line if (method_exists('Composer\Semver\CompilingMatcher', 'clear')) { // @phpstan-ignore function.alreadyNarrowedType
\Composer\Semver\CompilingMatcher::clear(); \Composer\Semver\CompilingMatcher::clear();
} }

View File

@ -72,11 +72,11 @@ final class ConfigReturnTypeExtension implements DynamicMethodReturnTypeExtensio
} }
$keyType = $scope->getType($args[0]->value); $keyType = $scope->getType($args[0]->value);
if (method_exists($keyType, 'getConstantStrings')) { // @phpstan-ignore-line - depending on PHPStan version, this method will always exist, or not. if (method_exists($keyType, 'getConstantStrings')) { // @phpstan-ignore function.alreadyNarrowedType (- depending on PHPStan version, this method will always exist, or not.)
$strings = $keyType->getConstantStrings(); $strings = $keyType->getConstantStrings();
} else { } else {
// for compat with old phpstan versions, we use a deprecated phpstan method. // for compat with old phpstan versions, we use a deprecated phpstan method.
$strings = TypeUtils::getConstantStrings($keyType); // @phpstan-ignore-line ignore deprecation $strings = TypeUtils::getConstantStrings($keyType); // @phpstan-ignore staticMethod.deprecated (ignore deprecation)
} }
if ($strings !== []) { if ($strings !== []) {
$types = []; $types = [];

View File

@ -59,7 +59,7 @@ class PostFileDownloadEvent extends Event
*/ */
public function __construct(string $name, ?string $fileName, ?string $checksum, string $url, string $type, $context = null) public function __construct(string $name, ?string $fileName, ?string $checksum, string $url, string $type, $context = null)
{ {
/** @phpstan-ignore-next-line */ /** @phpstan-ignore instanceof.alwaysFalse, booleanAnd.alwaysFalse */
if ($context === null && $type instanceof PackageInterface) { if ($context === null && $type instanceof PackageInterface) {
$context = $type; $context = $type;
$type = 'package'; $type = 'package';

View File

@ -432,7 +432,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
$uniques = []; $uniques = [];
foreach ($names as $name) { foreach ($names as $name) {
// @phpstan-ignore-next-line // @phpstan-ignore argument.type
$uniques[substr($name, 0, strpos($name, '/'))] = true; $uniques[substr($name, 0, strpos($name, '/'))] = true;
} }

View File

@ -176,7 +176,7 @@ class CurlDownloader
} }
$errorMessage = ''; $errorMessage = '';
// @phpstan-ignore-next-line // @phpstan-ignore argument.type
set_error_handler(static function ($code, $msg) use (&$errorMessage): void { set_error_handler(static function ($code, $msg) use (&$errorMessage): void {
if ($errorMessage) { if ($errorMessage) {
$errorMessage .= "\n"; $errorMessage .= "\n";

View File

@ -36,7 +36,7 @@ class Response
*/ */
public function __construct(array $request, ?int $code, array $headers, ?string $body) public function __construct(array $request, ?int $code, array $headers, ?string $body)
{ {
if (!isset($request['url'])) { // @phpstan-ignore-line if (!isset($request['url'])) {
throw new \LogicException('url key missing from request array'); throw new \LogicException('url key missing from request array');
} }
$this->request = $request; $this->request = $request;
@ -101,7 +101,7 @@ class Response
*/ */
public function collect(): void public function collect(): void
{ {
/** @phpstan-ignore-next-line */ /** @phpstan-ignore assign.propertyType, assign.propertyType, assign.propertyType */
$this->request = $this->code = $this->headers = $this->body = null; $this->request = $this->code = $this->headers = $this->body = null;
} }

View File

@ -248,7 +248,7 @@ class AllFunctionalTest extends TestCase
throw new \RuntimeException('The test file must have a section named "EXPECT", "EXPECT-REGEX", or "EXPECT-REGEXES".'); throw new \RuntimeException('The test file must have a section named "EXPECT", "EXPECT-REGEX", or "EXPECT-REGEXES".');
} }
return $data; // @phpstan-ignore-line return $data; // @phpstan-ignore return.type
} }
private function cleanOutput(string $output): string private function cleanOutput(string $output): string

View File

@ -420,7 +420,7 @@ class ConfigTest extends TestCase
]; ];
foreach ($keys as $key) { foreach ($keys as $key) {
$value = $config->get($key); $value = $config->get($key);
$this->assertIsArray($value); // @phpstan-ignore-line - PHPStan knows that its an array for all given keys $this->assertIsArray($value); // @phpstan-ignore staticMethod.dynamicCall (- PHPStan knows that its an array for all given keys)
$this->assertCount(0, $value); $this->assertCount(0, $value);
} }
} }

View File

@ -68,7 +68,7 @@ class RuleSetTest extends TestCase
$ruleSet = new RuleSet; $ruleSet = new RuleSet;
self::expectException('OutOfBoundsException'); self::expectException('OutOfBoundsException');
// @phpstan-ignore-next-line // @phpstan-ignore argument.type
$ruleSet->add(new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]), 7); $ruleSet->add(new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]), 7);
} }

View File

@ -24,8 +24,8 @@ final class IgnoreNothingPlatformRequirementFilterTest extends TestCase
{ {
$platformRequirementFilter = new IgnoreNothingPlatformRequirementFilter(); $platformRequirementFilter = new IgnoreNothingPlatformRequirementFilter();
$this->assertFalse($platformRequirementFilter->isIgnored($req)); // @phpstan-ignore-line $this->assertFalse($platformRequirementFilter->isIgnored($req)); // @phpstan-ignore staticMethod.dynamicCall
$this->assertFalse($platformRequirementFilter->isUpperBoundIgnored($req)); // @phpstan-ignore-line $this->assertFalse($platformRequirementFilter->isUpperBoundIgnored($req)); // @phpstan-ignore staticMethod.dynamicCall
} }
/** /**

View File

@ -42,7 +42,7 @@ class NullIOTest extends TestCase
{ {
$io = new NullIO(); $io = new NullIO();
$this->assertIsArray($io->getAuthentications()); // @phpstan-ignore-line $this->assertIsArray($io->getAuthentications()); // @phpstan-ignore staticMethod.dynamicCall
$this->assertEmpty($io->getAuthentications()); $this->assertEmpty($io->getAuthentications());
$this->assertEquals(['username' => null, 'password' => null], $io->getAuthentication('foo')); $this->assertEquals(['username' => null, 'password' => null], $io->getAuthentication('foo'));
} }

View File

@ -41,7 +41,7 @@ class InstalledVersionsTest extends TestCase
$prop = new \ReflectionProperty('Composer\Autoload\ClassLoader', 'registeredLoaders'); $prop = new \ReflectionProperty('Composer\Autoload\ClassLoader', 'registeredLoaders');
$prop->setAccessible(true); $prop->setAccessible(true);
$prop->setValue(null, self::$previousRegisteredLoaders); $prop->setValue(null, self::$previousRegisteredLoaders);
InstalledVersions::reload(null); // @phpstan-ignore-line InstalledVersions::reload(null); // @phpstan-ignore argument.type
} }
public function setUp(): void public function setUp(): void

View File

@ -279,7 +279,7 @@ class InstallerTest extends TestCase
{ {
if ($condition) { if ($condition) {
eval('$res = '.$condition.';'); eval('$res = '.$condition.';');
if (!$res) { // @phpstan-ignore-line if (!$res) { // @phpstan-ignore variable.undefined
$this->markTestSkipped($condition); $this->markTestSkipped($condition);
} }
} }

View File

@ -29,7 +29,7 @@ class JsonFormatterTest extends TestCase
$backslash = chr(92); $backslash = chr(92);
$data = '"' . $backslash . $backslash . $backslash . 'u0119"'; $data = '"' . $backslash . $backslash . $backslash . 'u0119"';
$expected = '"' . $backslash . $backslash . 'ę"'; $expected = '"' . $backslash . $backslash . 'ę"';
/** @phpstan-ignore-next-line */ /** @phpstan-ignore staticMethod.dynamicCall, staticMethod.deprecatedClass */
$this->assertEquals($expected, JsonFormatter::format($data, true, true)); $this->assertEquals($expected, JsonFormatter::format($data, true, true));
} }
@ -44,7 +44,7 @@ class JsonFormatterTest extends TestCase
} }
$escaped = '"\ud83d\ude00"'; $escaped = '"\ud83d\ude00"';
/** @phpstan-ignore-next-line */ /** @phpstan-ignore staticMethod.dynamicCall, staticMethod.deprecatedClass */
$this->assertEquals($escaped, JsonFormatter::format($escaped, true, true)); $this->assertEquals($escaped, JsonFormatter::format($escaped, true, true));
} }
} }

View File

@ -90,7 +90,7 @@ class HttpDownloaderMock extends HttpDownloader
} }
// dummy assertion to ensure the test is not marked as having no assertions // dummy assertion to ensure the test is not marked as having no assertions
Assert::assertTrue(true); // @phpstan-ignore-line Assert::assertTrue(true); // @phpstan-ignore staticMethod.alreadyNarrowedType
} }
public function get($fileUrl, $options = []): Response public function get($fileUrl, $options = []): Response

View File

@ -142,7 +142,7 @@ class IOMock extends BufferIO
} }
// dummy assertion to ensure the test is not marked as having no assertions // dummy assertion to ensure the test is not marked as having no assertions
Assert::assertTrue(true); // @phpstan-ignore-line Assert::assertTrue(true); // @phpstan-ignore staticMethod.alreadyNarrowedType
} }
/** /**

View File

@ -100,7 +100,7 @@ class ProcessExecutorMock extends ProcessExecutor
} }
// dummy assertion to ensure the test is not marked as having no assertions // dummy assertion to ensure the test is not marked as having no assertions
Assert::assertTrue(true); // @phpstan-ignore-line Assert::assertTrue(true); // @phpstan-ignore staticMethod.alreadyNarrowedType
} }
public function execute($command, &$output = null, ?string $cwd = null): int public function execute($command, &$output = null, ?string $cwd = null): int

View File

@ -81,7 +81,7 @@ class ArrayDumperTest extends TestCase
{ {
$package = self::getRootPackage(); $package = self::getRootPackage();
// @phpstan-ignore-next-line // @phpstan-ignore method.dynamicName, ternary.shortNotAllowed
$package->{'set'.ucfirst($method ?: $key)}($value); $package->{'set'.ucfirst($method ?: $key)}($value);
$config = $this->dumper->dump($package); $config = $this->dumper->dump($package);

View File

@ -160,7 +160,7 @@ class PluginInstallerTest extends TestCase
$installer->install($this->repository, $this->packages[0]); $installer->install($this->repository, $this->packages[0]);
$plugins = $this->pm->getPlugins(); $plugins = $this->pm->getPlugins();
$this->assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore-line $this->assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
$this->assertEquals( $this->assertEquals(
'activate v1'.PHP_EOL, 'activate v1'.PHP_EOL,
$this->io->getOutput() $this->io->getOutput()
@ -186,7 +186,7 @@ class PluginInstallerTest extends TestCase
'activate v1'.PHP_EOL, 'activate v1'.PHP_EOL,
$this->io->getOutput() $this->io->getOutput()
); );
$this->assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore-line $this->assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
} }
public function testInstallMultiplePlugins(): void public function testInstallMultiplePlugins(): void
@ -201,10 +201,10 @@ class PluginInstallerTest extends TestCase
$installer->install($this->repository, $this->packages[3]); $installer->install($this->repository, $this->packages[3]);
$plugins = $this->pm->getPlugins(); $plugins = $this->pm->getPlugins();
$this->assertEquals('plugin1', $plugins[0]->name); // @phpstan-ignore-line $this->assertEquals('plugin1', $plugins[0]->name); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
$this->assertEquals('installer-v4', $plugins[0]->version); // @phpstan-ignore-line $this->assertEquals('installer-v4', $plugins[0]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
$this->assertEquals('plugin2', $plugins[1]->name); // @phpstan-ignore-line $this->assertEquals('plugin2', $plugins[1]->name); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
$this->assertEquals('installer-v4', $plugins[1]->version); // @phpstan-ignore-line $this->assertEquals('installer-v4', $plugins[1]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
$this->assertEquals('activate v4-plugin1'.PHP_EOL.'activate v4-plugin2'.PHP_EOL, $this->io->getOutput()); $this->assertEquals('activate v4-plugin1'.PHP_EOL.'activate v4-plugin2'.PHP_EOL, $this->io->getOutput());
} }
@ -225,7 +225,7 @@ class PluginInstallerTest extends TestCase
$plugins = $this->pm->getPlugins(); $plugins = $this->pm->getPlugins();
$this->assertCount(1, $plugins); $this->assertCount(1, $plugins);
$this->assertEquals('installer-v2', $plugins[1]->version); // @phpstan-ignore-line $this->assertEquals('installer-v2', $plugins[1]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
$this->assertEquals('activate v1'.PHP_EOL.'deactivate v1'.PHP_EOL.'activate v2'.PHP_EOL, $this->io->getOutput()); $this->assertEquals('activate v1'.PHP_EOL.'deactivate v1'.PHP_EOL.'activate v2'.PHP_EOL, $this->io->getOutput());
} }
@ -265,7 +265,7 @@ class PluginInstallerTest extends TestCase
$installer->update($this->repository, $this->packages[1], $this->packages[2]); $installer->update($this->repository, $this->packages[1], $this->packages[2]);
$plugins = $this->pm->getPlugins(); $plugins = $this->pm->getPlugins();
$this->assertEquals('installer-v3', $plugins[1]->version); // @phpstan-ignore-line $this->assertEquals('installer-v3', $plugins[1]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
$this->assertEquals('activate v2'.PHP_EOL.'deactivate v2'.PHP_EOL.'activate v3'.PHP_EOL, $this->io->getOutput()); $this->assertEquals('activate v2'.PHP_EOL.'deactivate v2'.PHP_EOL.'activate v3'.PHP_EOL, $this->io->getOutput());
} }
@ -283,7 +283,7 @@ class PluginInstallerTest extends TestCase
$plugins = $this->pm->getPlugins(); $plugins = $this->pm->getPlugins();
$this->assertCount(1, $plugins); $this->assertCount(1, $plugins);
$this->assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore-line $this->assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
$this->assertEquals('activate v1'.PHP_EOL, $this->io->getOutput()); $this->assertEquals('activate v1'.PHP_EOL, $this->io->getOutput());
} }

View File

@ -5,7 +5,7 @@
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => 'sourceref-by-default', 'reference' => 'sourceref-by-default',
'type' => 'library', 'type' => 'library',
// @phpstan-ignore-next-line // @phpstan-ignore variable.undefined
'install_path' => $dir . '/./', 'install_path' => $dir . '/./',
'aliases' => array( 'aliases' => array(
'1.10.x-dev', '1.10.x-dev',
@ -18,7 +18,7 @@
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => 'sourceref-by-default', 'reference' => 'sourceref-by-default',
'type' => 'library', 'type' => 'library',
// @phpstan-ignore-next-line // @phpstan-ignore variable.undefined
'install_path' => $dir . '/./', 'install_path' => $dir . '/./',
'aliases' => array( 'aliases' => array(
'1.10.x-dev', '1.10.x-dev',
@ -30,7 +30,7 @@
'version' => '1.1.0.0', 'version' => '1.1.0.0',
'reference' => 'distref-as-no-source', 'reference' => 'distref-as-no-source',
'type' => 'library', 'type' => 'library',
// @phpstan-ignore-next-line // @phpstan-ignore variable.undefined
'install_path' => $dir . '/vendor/a/provider', 'install_path' => $dir . '/vendor/a/provider',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
@ -40,7 +40,7 @@
'version' => '1.2.0.0', 'version' => '1.2.0.0',
'reference' => 'distref-as-installed-from-dist', 'reference' => 'distref-as-installed-from-dist',
'type' => 'library', 'type' => 'library',
// @phpstan-ignore-next-line // @phpstan-ignore variable.undefined
'install_path' => $dir . '/vendor/a/provider2', 'install_path' => $dir . '/vendor/a/provider2',
'aliases' => array( 'aliases' => array(
'1.4', '1.4',
@ -52,7 +52,7 @@
'version' => '2.2.0.0', 'version' => '2.2.0.0',
'reference' => null, 'reference' => null,
'type' => 'library', 'type' => 'library',
// @phpstan-ignore-next-line // @phpstan-ignore variable.undefined
'install_path' => $dir . '/vendor/b/replacer', 'install_path' => $dir . '/vendor/b/replacer',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,

View File

@ -35,7 +35,7 @@ class EventTest extends TestCase
$scriptEvent->setOriginatingEvent($originatingEvent); $scriptEvent->setOriginatingEvent($originatingEvent);
// @phpstan-ignore-next-line // @phpstan-ignore staticMethod.dynamicCall
$this->assertSame( $this->assertSame(
$originatingEvent, $originatingEvent,
$scriptEvent->getOriginatingEvent(), $scriptEvent->getOriginatingEvent(),

View File

@ -45,7 +45,7 @@ class ErrorHandlerTest extends TestCase
} }
$array = ['foo' => 'bar']; $array = ['foo' => 'bar'];
// @phpstan-ignore-next-line // @phpstan-ignore offsetAccess.notFound, expr.resultUnused
$array['baz']; $array['baz'];
} }
@ -62,7 +62,7 @@ class ErrorHandlerTest extends TestCase
self::expectExceptionMessage('array_merge'); self::expectExceptionMessage('array_merge');
} }
// @phpstan-ignore-next-line // @phpstan-ignore function.resultUnused, argument.type
array_merge([], 'string'); array_merge([], 'string');
} }

View File

@ -27,7 +27,7 @@ class TlsHelperTest extends TestCase
$certificate['subject']['commonName'] = $expectedCn = array_shift($certNames); $certificate['subject']['commonName'] = $expectedCn = array_shift($certNames);
$certificate['extensions']['subjectAltName'] = $certNames ? 'DNS:'.implode(',DNS:', $certNames) : ''; $certificate['extensions']['subjectAltName'] = $certNames ? 'DNS:'.implode(',DNS:', $certNames) : '';
// @phpstan-ignore-next-line // @phpstan-ignore staticMethod.deprecatedClass
$result = TlsHelper::checkCertificateHost($certificate, $hostname, $foundCn); $result = TlsHelper::checkCertificateHost($certificate, $hostname, $foundCn);
if (true === $expectedResult) { if (true === $expectedResult) {
@ -70,7 +70,7 @@ class TlsHelperTest extends TestCase
$certificate['subject']['commonName'] = 'example.net'; $certificate['subject']['commonName'] = 'example.net';
$certificate['extensions']['subjectAltName'] = 'DNS: example.com, IP: 127.0.0.1, DNS: getcomposer.org, Junk: blah, DNS: composer.example.org'; $certificate['extensions']['subjectAltName'] = 'DNS: example.com, IP: 127.0.0.1, DNS: getcomposer.org, Junk: blah, DNS: composer.example.org';
// @phpstan-ignore-next-line // @phpstan-ignore staticMethod.deprecatedClass
$names = TlsHelper::getCertificateNames($certificate); $names = TlsHelper::getCertificateNames($certificate);
self::assertIsArray($names); self::assertIsArray($names);