Skip to content

ContextFactory wrongly detect use statement #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maMykola opened this issue Aug 11, 2023 · 4 comments
Closed

ContextFactory wrongly detect use statement #191

maMykola opened this issue Aug 11, 2023 · 4 comments

Comments

@maMykola
Copy link
Contributor

maMykola commented Aug 11, 2023

The ContextFactory::createForNamespace() wrongly detect use statements for class, f.e. if I have closure with use statement it's detected as a use statement for trait, but shouldn't:

trait MyTrait
{
    protected function check(array $data): void
    {
        $key = 'test';

        array_walk($data, function (&$item) use ($key) {
            // modify $item
        });
    }
}
@maMykola
Copy link
Contributor Author

Perhaps it'll be safe to add case T_TRAIT: alongside with T_CLASS https://github.com/phpDocumentor/TypeResolver/blob/1.x/src/Types/ContextFactory.php#L183

@maMykola
Copy link
Contributor Author

Here is the fix for this issue #192

@jaapio
Copy link
Member

jaapio commented Aug 12, 2023

Thanks for your report, and fix this issue can be closed.

@jaapio jaapio closed this as completed Aug 12, 2023
@jaapio
Copy link
Member

jaapio commented Aug 12, 2023

I released 1.7.3 with your bugfix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants