Skip to content
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

Catch more "There should be a node type provider" exceptions #55

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

anomiex
Copy link
Contributor

@anomiex anomiex commented Feb 29, 2024

In #47 a try-catch was added to handle one case where ->getStatementsSource()->getNodeTypeProvider() is being called and is throwing an exception because Psalm's FileAnalyzer doesn't populate the node type provider until after its NamespaceAnalyzer has already tried to analyze the whole file (see also #34).

There are three other code paths making a similar call, at least one of which runs into the same problem. Let's add try-catches to all of them.

In psalm#47 a try-catch was added to handle one case where
`->getStatementsSource()->getNodeTypeProvider()` is being called and is
throwing an exception because Psalm's FileAnalyzer doesn't populate the
node type provider until after its NamespaceAnalyzer has already tried
to analyze the whole file (see also psalm#34).

There are three other code paths making a similar call, at least one of
which runs into the same problem. Let's add try-catches to all of them.
@kkmuffme kkmuffme merged commit 0130a4e into psalm:master Feb 29, 2024
5 checks passed
@kkmuffme
Copy link
Collaborator

Thanks!
As per #34 I think eventually the logic has to be reworked to process this in a different order so data there won't be empty in the first place.

@anomiex anomiex deleted the fix/missing-node-provider branch February 29, 2024 13:25
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

Successfully merging this pull request may close these issues.

2 participants