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

Choose a common tag to suggest that the result of a function/closure/method should be used #4

Open
TysonAndre opened this issue Oct 26, 2019 · 0 comments

Comments

@TysonAndre
Copy link
Member

Psalm has psalm-pure/psalm-external-mutation-free/psalm-internal-mutation-free. https://github.com/vimeo/psalm/blob/master/docs/annotating_code/supported_annotations.md#psalm-mutation-free

Phan has @phan-side-effect-free, which isn't as strict - it allows functions that aren't deterministic such as rand(), file_get_contents(), microtime(), etc.

It would be useful to have a common annotation for at least one of the following options:

  1. The return value of this function must be used (e.g. opening a resource)

    @must-use (haven't put much thought into the name)

  2. The return value of this function must be used, and this (should be treated as if) there are no side effects internally or externally (e.g. computing the Nth prime)

    Ideas: @[effectively-]side-effect-free, @x-pure, etc.

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

1 participant