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

fix: mark Ds\Queue::pop() as impure #2550

Merged
merged 1 commit into from Jul 25, 2023
Merged

Conversation

simPod
Copy link
Contributor

@simPod simPod commented Jul 25, 2023

Resolves #9682

@phpstan-bot
Copy link
Collaborator

You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x.

@ondrejmirtes
Copy link
Member

Can you please check other similar methods that might have the same problem? The key is that the method returns a value AND changes the underlying collection.

Such an example: Stack::pop()

If it does not return a value (it's void) then such a method is already understood as impure by PHPStan.

@simPod
Copy link
Contributor Author

simPod commented Jul 25, 2023

I tried to mark all eligible I know of.

@ondrejmirtes
Copy link
Member

I don't think that first/last and peek are impure.

@simPod
Copy link
Contributor Author

simPod commented Jul 25, 2023

ok i missed "changes" in The key is that the method returns a value AND changes the underlying collection.

@ondrejmirtes ondrejmirtes merged commit 25f390f into phpstan:1.10.x Jul 25, 2023
409 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants