diff --git a/stubs/typeCheckingFunctions.stub b/stubs/typeCheckingFunctions.stub index 82d9c83cde..4f06338125 100644 --- a/stubs/typeCheckingFunctions.stub +++ b/stubs/typeCheckingFunctions.stub @@ -105,7 +105,7 @@ function is_long(mixed $value): bool } /** - * @phpstan-assert-if-true resource $value + * @phpstan-assert-if-true =resource $value * @return bool */ function is_resource(mixed $value): bool diff --git a/tests/PHPStan/Analyser/NodeScopeResolverTest.php b/tests/PHPStan/Analyser/NodeScopeResolverTest.php index 3a1bf98033..6a8c6b517d 100644 --- a/tests/PHPStan/Analyser/NodeScopeResolverTest.php +++ b/tests/PHPStan/Analyser/NodeScopeResolverTest.php @@ -143,6 +143,8 @@ public function dataFileAsserts(): iterable yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Functions/data/bug-7823.php'); } + yield from $this->gatherAssertTypes(__DIR__ . '/../Analyser/data/is-resource-specified.php'); + yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Arrays/data/bug-7954.php'); yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Comparison/data/docblock-assert-equality.php'); yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Properties/data/bug-7839.php'); diff --git a/tests/PHPStan/Analyser/data/is-resource-specified.php b/tests/PHPStan/Analyser/data/is-resource-specified.php new file mode 100644 index 0000000000..c78d5ad75a --- /dev/null +++ b/tests/PHPStan/Analyser/data/is-resource-specified.php @@ -0,0 +1,11 @@ +