From 7d32ab2048ce890dc46bf1e247ade837ac0a02db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Sun, 25 Apr 2021 09:55:02 +0200 Subject: [PATCH] DX: remove PHPStan exceptions for "tests" from phpstan.neon --- phpstan.neon | 15 --------------- tests/ConfigTest.php | 4 ++-- tests/Console/ConfigurationResolverTest.php | 4 ++-- .../FixerConfigurationResolverRootlessTest.php | 2 +- tests/Indicator/PhpUnitTestCaseIndicatorTest.php | 2 +- 5 files changed, 6 insertions(+), 21 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index aff59614c4a..aeb7ee9429c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -35,32 +35,17 @@ parameters: paths: - src/Config.php - src/Tokenizer/Token.php - - - message: '/^Parameter #1 \$fixers of method PhpCsFixer\\Config::registerCustomFixers\(\) expects iterable, string given\.$/' - path: tests/ConfigTest.php - - - message: '/^Parameter #1 \$options of method PhpCsFixer\\FixerConfiguration\\FixerConfigurationResolverRootless::resolve\(\) expects array, array given\.$/' - path: tests/FixerConfiguration/FixerConfigurationResolverRootlessTest.php - message: '/^Parameter #1 \$function of function register_shutdown_function expects callable\(\): void, array\(\$this\(PhpCsFixer\\FileRemoval\), ''clean''\) given\.$/' path: src/FileRemoval.php - - - message: '/^Parameter #1 \$finder of method PhpCsFixer\\Config::setFinder\(\) expects iterable, int given\.$/' - path: tests/ConfigTest.php - # https://github.com/phpstan/phpstan/issues/1215 message: '/^Strict comparison using === between false and string will always evaluate to false\.$/' path: src/Fixer/StringNotation/NoTrailingWhitespaceInStringFixer.php - - - message: '/^Property .*::\$indicator .* does not accept null\.$/' - path: tests/Indicator/PhpUnitTestCaseIndicatorTest.php - message: '/^Constant T_ATTRIBUTE not found\.$/' path: src/Tokenizer/Transformer/AttributeTransformer.php - message: '/^\$this\(PhpCsFixer\\Tokenizer\\Tokens\) does not accept PhpCsFixer\\Tokenizer\\Token\|null\.$/' path: src/Tokenizer/Tokens.php - - - message: '/^Class Test\dConfig not found\.$/' - path: tests/Console/ConfigurationResolverTest.php tipsOfTheDay: false diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index 780e9a808d8..95e5e377833 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -193,7 +193,7 @@ public function testRegisterCustomFixersWithInvalidArgument() $this->expectExceptionMessageMatches('/^Argument must be an array or a Traversable, got "\w+"\.$/'); $config = new Config(); - $config->registerCustomFixers('foo'); + $config->registerCustomFixers('foo'); // @phpstan-ignore-line to avoid `expects iterable, string given` } /** @@ -259,7 +259,7 @@ public function testSetInvalidFinder() $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessageMatches('/^Argument must be an array or a Traversable, got "integer"\.$/'); - $config->setFinder(123); + $config->setFinder(123); // @phpstan-ignore-line to avoid `expects iterable, int given` } /** diff --git a/tests/Console/ConfigurationResolverTest.php b/tests/Console/ConfigurationResolverTest.php index d2fe33087a6..4ce71eb983d 100644 --- a/tests/Console/ConfigurationResolverTest.php +++ b/tests/Console/ConfigurationResolverTest.php @@ -205,7 +205,7 @@ public function testResolveConfigFileByPathOfFile() $resolver = $this->createConfigurationResolver(['path' => [$dir.\DIRECTORY_SEPARATOR.'foo.php']]); static::assertSame($dir.\DIRECTORY_SEPARATOR.'.php_cs.dist', $resolver->getConfigFile()); - static::assertInstanceOf(\Test1Config::class, $resolver->getConfig()); + static::assertInstanceOf(\Test1Config::class, $resolver->getConfig()); // @phpstan-ignore-line to avoid `Class Test1Config not found.` } public function testResolveConfigFileSpecified() @@ -215,7 +215,7 @@ public function testResolveConfigFileSpecified() $resolver = $this->createConfigurationResolver(['config' => $file]); static::assertSame($file, $resolver->getConfigFile()); - static::assertInstanceOf(\Test4Config::class, $resolver->getConfig()); + static::assertInstanceOf(\Test4Config::class, $resolver->getConfig()); // @phpstan-ignore-line to avoid `Class Test4Config not found.` } /** diff --git a/tests/FixerConfiguration/FixerConfigurationResolverRootlessTest.php b/tests/FixerConfiguration/FixerConfigurationResolverRootlessTest.php index fb4e9a30bbf..a76b1c176cd 100644 --- a/tests/FixerConfiguration/FixerConfigurationResolverRootlessTest.php +++ b/tests/FixerConfiguration/FixerConfigurationResolverRootlessTest.php @@ -44,6 +44,6 @@ public function testResolveWithMappedRoot() static::assertSame($options, $configuration->getOptions()); - $configuration->resolve(['baz', 'qux']); + $configuration->resolve(['baz' => 'qux']); } } diff --git a/tests/Indicator/PhpUnitTestCaseIndicatorTest.php b/tests/Indicator/PhpUnitTestCaseIndicatorTest.php index b10bb81eab1..1ee966fdff6 100644 --- a/tests/Indicator/PhpUnitTestCaseIndicatorTest.php +++ b/tests/Indicator/PhpUnitTestCaseIndicatorTest.php @@ -25,7 +25,7 @@ final class PhpUnitTestCaseIndicatorTest extends TestCase { /** - * @var PhpUnitTestCaseIndicator + * @var null|PhpUnitTestCaseIndicator */ private $indicator;