Skip to content

Exit early in TrinaryLogic::lazyAnd() and lazyOr() if current instance allows it #2173

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

Merged
merged 1 commit into from
Jan 9, 2023

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Jan 9, 2023

In the scope of the lazy methods this makes sense to me. But this change won't affect PHPStan at all at the moment, because all lazyAnd() and lazyOr() are called on valid yes or no already. It would lead to an early exit potentially if those methods would be used more dynamically like e.g. TrinaryLogic::createFromBoolean($expression)->lazyAnd(...)

this is covered by already existing tests at least so far that tests would break if the logic is inverted.

@ondrejmirtes ondrejmirtes merged commit 2461a5a into phpstan:1.9.x Jan 9, 2023
@ondrejmirtes
Copy link
Member

Thank you!

@herndlm herndlm deleted the trinary-logic-lazy-early-exit branch January 9, 2023 12:25
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.

2 participants