Skip to content

Fix int-range return type for range()#2792

Merged
ondrejmirtes merged 5 commits intophpstan:1.10.xfrom
dantleech:range-int-range
Jan 6, 2024
Merged

Fix int-range return type for range()#2792
ondrejmirtes merged 5 commits intophpstan:1.10.xfrom
dantleech:range-int-range

Conversation

@dantleech
Copy link
Contributor

@dantleech dantleech commented Nov 28, 2023

Fixes the return type of range when passed IntegerRange

Fixes phpstan/phpstan#10213

@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.

@dantleech dantleech changed the base branch from 1.11.x to 1.10.x November 28, 2023 14:34
@dantleech dantleech force-pushed the range-int-range branch 2 times, most recently from 2d2e840 to d61600c Compare November 28, 2023 14:38
@dantleech
Copy link
Contributor Author

dantleech commented Nov 28, 2023

out of curiosity - is there a way to eliminate the delay before the test runs? or to filter a specific test case (the range-int-range.php)

@ondrejmirtes
Copy link
Member

@dantleech When I want to debug something NodeScopeResolverTest, I just run PHPStan on that file. Both TypeInferenceTestCase run through PHPUnit, and PHPStan analysis itself, will report discrepancies in assertType etc.

@dantleech
Copy link
Contributor Author

makes sense! thanks

@dantleech dantleech marked this pull request as ready for review November 28, 2023 14:55
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for a late review.

  1. Look at the issue bot: https://github.com/phpstan/phpstan-src/actions/runs/7020506328 This also fixes phpstan/phpstan#9573 so please write a regression test.
  2. Please test different ranges passed into the range function. For example for int<5, 10> and int<5, 8>, the resulting range is int<5, 8> I think? Please come up with more test cases to make sure the math is correct.

Thank you.

@dantleech
Copy link
Contributor Author

Updated!

@ondrejmirtes ondrejmirtes merged commit 9d3eba2 into phpstan:1.10.x Jan 6, 2024
@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

Development

Successfully merging this pull request may close these issues.

4 participants

Comments