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 int-range return type for range() #2792

Merged
merged 5 commits into from
Jan 6, 2024

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 Regarding the analysis of the return value of range() 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
426 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
4 participants