diff --git a/stubs/Reflection.phpstub b/stubs/Reflection.phpstub index 11dcf4537e2..8cb358f8e03 100644 --- a/stubs/Reflection.phpstub +++ b/stubs/Reflection.phpstub @@ -51,7 +51,7 @@ class ReflectionClass implements Reflector { * @since 8.0 * @template TClass as object * @param class-string|null $name - * @return array> + * @return (TClass is object ? array> : array>) */ public function getAttributes(?string $name = null, int $flags = 0): array {} } diff --git a/tests/AttributeTest.php b/tests/AttributeTest.php index 4912c532f75..513c4b932fd 100644 --- a/tests/AttributeTest.php +++ b/tests/AttributeTest.php @@ -102,6 +102,31 @@ function foo(string $s) : void { [], '8.0' ], + 'testReflectingAllAttributes' => [ + 'getAttributes(); + scope($b); + } + } + + /** @param array> $_a */ + function scope($_a):void{ + + } + ', + [], + [], + '8.0' + ], 'convertKeyedArray' => [ '