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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new @psalm-allow-private-mutation annotation #2733

Merged
merged 3 commits into from Feb 2, 2020

Conversation

christian-kolb
Copy link
Contributor

Pull request to solve #2729.

@muglug As discussed here is the documentation part of the annotation. I tried to make it as similar to the other annotations as possible. Let me know if I should change anything there.
I'm very curious to see how you'll implement the annotation. Hopefully I will understand it with this example, then I might be able to offer the implementation for further annotations in the future myself 馃檪
Thanks again for your offer to do the implementation for this one!

@christian-kolb christian-kolb changed the title Add new @psalm-private-set annotation Add new @psalm-private-mutate annotation Feb 2, 2020
@muglug muglug changed the title Add new @psalm-private-mutate annotation Add new @psalm-allow-private-mutation annotation Feb 2, 2020
@muglug muglug merged commit 93c613b into vimeo:master Feb 2, 2020
@muglug
Copy link
Collaborator

muglug commented Feb 2, 2020

Thanks! I decided that this should just be a modifier for @readonly properties, as those semantics were already well-defined within Psalm, and understood externally.

Adding @psalm-allow-private-mutation to a property with a @readonly annotation prevents allows it to be edited within the class.

Another alternative to this would be @psalm-readonly-allow-private-mutation, which would combine the two. In fact I think I'll document that myself.

@muglug
Copy link
Collaborator

muglug commented Feb 2, 2020

Added in b3f6b56

@christian-kolb
Copy link
Contributor Author

Thanks! I decided that this should just be a modifier for @readonly properties, as those semantics were already well-defined within Psalm, and understood externally.

Adding @psalm-allow-private-mutation to a property with a @readonly annotation prevents allows it to be edited within the class.

Another alternative to this would be @psalm-readonly-allow-private-mutation, which would combine the two. In fact I think I'll document that myself.

@muglug Yes, that makes so much more sense 馃檪 Thanks for the implementation

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.

None yet

3 participants