From 2632168fde1decb78fba712ce4d1db190043e71f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 11 Jul 2024 10:53:05 +0200 Subject: [PATCH] Tweaks --- extension.neon | 2 +- phpstan.neon.dist | 4 ++-- src/PHPStan/PregMatchFlags.php | 2 +- src/PHPStan/PregMatchTypeSpecifyingExtension.php | 2 -- tests/PHPStanTests/TypeInferenceTest.php | 12 +++++++----- tests/PHPStanTests/nsrt/preg-match.php | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/extension.neon b/extension.neon index 8fbd453..282b8d4 100644 --- a/extension.neon +++ b/extension.neon @@ -13,4 +13,4 @@ services: - class: Composer\Pcre\PHPStan\PregMatchParameterOutTypeExtension - - class: Composer\Pcre\PHPStan\PregMatchTypeSpecifyingExtension \ No newline at end of file + class: Composer\Pcre\PHPStan\PregMatchTypeSpecifyingExtension diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 6d1203d..900cf2d 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -7,8 +7,8 @@ parameters: reportUnmatchedIgnoredErrors: false treatPhpDocTypesAsCertain: false - ignoreErrors: - - '#Test::data[a-zA-Z0-9_]+\(\) return type has no value type specified in iterable type#' + bootstrapFiles: + - tests/phpstan-locate-phpunit-autoloader.php excludePaths: - tests/PHPStanTests/nsrt/* diff --git a/src/PHPStan/PregMatchFlags.php b/src/PHPStan/PregMatchFlags.php index cd0f841..08d7e6b 100644 --- a/src/PHPStan/PregMatchFlags.php +++ b/src/PHPStan/PregMatchFlags.php @@ -32,4 +32,4 @@ static public function getType(?Arg $flagsArg, Scope $scope): ?Type } return TypeCombinator::union(...$internalFlagsTypes); } -} \ No newline at end of file +} diff --git a/src/PHPStan/PregMatchTypeSpecifyingExtension.php b/src/PHPStan/PregMatchTypeSpecifyingExtension.php index eed8aca..425070c 100644 --- a/src/PHPStan/PregMatchTypeSpecifyingExtension.php +++ b/src/PHPStan/PregMatchTypeSpecifyingExtension.php @@ -28,7 +28,6 @@ public function __construct( $this->regexShapeMatcher = $regexShapeMatcher; } - public function setTypeSpecifier(TypeSpecifier $typeSpecifier): void { $this->typeSpecifier = $typeSpecifier; @@ -83,5 +82,4 @@ public function specifyTypes(MethodReflection $methodReflection, StaticCall $nod $node, ); } - } diff --git a/tests/PHPStanTests/TypeInferenceTest.php b/tests/PHPStanTests/TypeInferenceTest.php index aa59b8f..ed5be84 100644 --- a/tests/PHPStanTests/TypeInferenceTest.php +++ b/tests/PHPStanTests/TypeInferenceTest.php @@ -15,10 +15,12 @@ class TypeInferenceTest extends TypeInferenceTestCase { + /** + * @return mixed + */ public function dataFileAsserts(): iterable { yield from $this->gatherAssertTypesFromDirectory(__DIR__ . '/nsrt'); - } /** @@ -28,9 +30,9 @@ public function dataFileAsserts(): iterable public function testFileAsserts( string $assertType, string $file, - ...$args - ): void - { + ...$args + ): void + { $this->assertFileAsserts($assertType, $file, ...$args); } @@ -41,4 +43,4 @@ public static function getAdditionalConfigFiles(): array __DIR__ . '/../../extension.neon', ]; } -} \ No newline at end of file +} diff --git a/tests/PHPStanTests/nsrt/preg-match.php b/tests/PHPStanTests/nsrt/preg-match.php index 7d8993d..0f3701b 100644 --- a/tests/PHPStanTests/nsrt/preg-match.php +++ b/tests/PHPStanTests/nsrt/preg-match.php @@ -47,4 +47,4 @@ function equalMatch(string $s): void assertType('array{}', $matches); } assertType('array{}|array{string}', $matches); -} \ No newline at end of file +}