Skip to content

The @var annotation is not considered for a wrapped iterator #466

@morozov

Description

@morozov

https://phpstan.org/r/58d5ff2a2e05bfcba9851d98cfe94fa5

Not sure if it's by design and documented, but classes like RecursiveDirectoryIterator seem to proxy unsupported method calls to the wrapped iterators. With the @var annotation, PhpStorm, for example, understands that the call will be made on a RecursiveDirectoryIterator instance and doesn't flag the code as incorrect, but PHPStan does.

Calling getSubPathName() on RecursiveDirectoryIterator doesn't seem a valid fix since it produces different results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions