Skip to content

(ReflectionClass|ReflectionMethod)->getAttributes(I::class, ReflectionAttribute::IS_INSTANCEOF) not resolved anymore (2.1.47 regression) #14466

@LastDragon-ru

Description

@LastDragon-ru

Bug report

Since 2.1.47 the following code will be resoved to list<ReflectionAttribute<object>> instead of list<ReflectionAttribute<I>>.

    /**
     * @param ReflectionClass<*>|ReflectionMethod $object
     */
    protected function bug(ReflectionClass|ReflectionMethod $object): void {
        $requirements = $object->getAttributes(I::class, ReflectionAttribute::IS_INSTANCEOF);
		
	\PHPStan\dumpType($requirements);
    }

Code snippet that reproduces the problem

https://phpstan.org/r/c5fe63b2-5c44-4f34-8eb3-7d4a633ca6b7

Expected output

list<ReflectionAttribute<I>>

Did PHPStan help you today? Did it make you happy in any way?

Yep.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions