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

Add @psalm-pure to the typeToString method #303

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

luukvhoudt
Copy link

When extending the Assert class it can be difficult to keep custom methods pure, especially when opting for the use of the Assert::typeToString method. This results in the following Psalm error at the call to the typetoString method:

ImpureMethodCall: Cannot call an impure method from a pure context

Currently there are two options to avoid the error:

  • Don't mark your custom method pure.
  • Suppress the ImpureMethodCall psalm error for your custom pure method.

Ideally you neither pick one of those options.

This PR fixes the error for good error by marking the Assert::typeToString method as @psalm-pure.

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.

1 participant