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

Maintenance #389

Merged
merged 4 commits into from
Oct 23, 2024
Merged

Maintenance #389

merged 4 commits into from
Oct 23, 2024

Conversation

greg0ire
Copy link
Member

No description provided.

@greg0ire greg0ire force-pushed the maintenance branch 2 times, most recently from 830bd1a to 42922a0 Compare October 22, 2024 19:47
/**
* {@inheritDoc}
*
* @psalm-external-mutation-free
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPStan apparently doesn't understand that annotation, but then again, it does not complain when it is gone.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why it was used for those getters.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpstan memoizes getters by default unless tagged with @phpstan-impure, while psalm does not. This @psalm-external-mutation-free is required for Psalm to consider that calling a method does not mutate other things and so it can remember refinements it did for calls.

@greg0ire greg0ire added this to the 3.3.4 milestone Oct 23, 2024
@greg0ire greg0ire added the CI label Oct 23, 2024
@greg0ire greg0ire merged commit dd6bbae into doctrine:3.3.x Oct 23, 2024
13 checks passed
@greg0ire greg0ire deleted the maintenance branch October 23, 2024 06:46
* @psalm-suppress ArgumentTypeCoercion
* @psalm-suppress UndefinedClass
* @phpstan-suppress ArgumentTypeCoercion
* @phpstan-suppress UndefinedClass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppressing a psalm error with a phpstan-suppress annotation does not make any sense. @phpstan-suppress does not exist (the equivalent feature in phpstan uses the @phpstan-ignore-* tags, as used just below)

/**
* {@inheritDoc}
*
* @psalm-external-mutation-free
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpstan memoizes getters by default unless tagged with @phpstan-impure, while psalm does not. This @psalm-external-mutation-free is required for Psalm to consider that calling a method does not mutate other things and so it can remember refinements it did for calls.

This was referenced Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants