Skip to content

Implement assertGreaterThan() and assertLessThan() type narrowing - #351

Merged
staabm merged 3 commits into
phpstan:2.1.xfrom
staabm:narrow-greater-less
Nov 12, 2026
Merged

staabm merged 3 commits into
phpstan:2.1.xfrom
staabm:narrow-greater-less

Conversation

@staabm

@staabm staabm commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

refs #350


I left out *OrEqual-variants because PHPUnit checks them as "equal (using its comparator) or greater/less", not as PHP's >=/<=. For ints, floats and numeric strings this makes no difference. For arrays or objects it might narrow slightly differently.

@staabm
staabm marked this pull request as ready for review November 12, 2026 14:58
@staabm

staabm commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

//cc @SanderMuller

@staabm
staabm merged commit ffff35d into phpstan:2.1.x Nov 12, 2026
113 checks passed
@staabm
staabm deleted the narrow-greater-less branch November 13, 2026 10:29
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