Truthy isset($arr[$k]) should narrow $k#3453
Merged
ondrejmirtes merged 19 commits intophpstan:1.12.xfrom Sep 22, 2024
Merged
Conversation
Contributor
Author
|
I am puzzled by the test and its expectations: phpstan-src/tests/PHPStan/Rules/Variables/data/bug-10577.php Lines 9 to 27 in cb8f910 I feel the assertion in this test is wrong, see https://3v4l.org/WD7OG |
staabm
commented
Sep 19, 2024
mvorisek
reviewed
Sep 19, 2024
staabm
commented
Sep 19, 2024
mvorisek
reviewed
Sep 20, 2024
mvorisek
reviewed
Sep 20, 2024
mvorisek
reviewed
Sep 20, 2024
mvorisek
reviewed
Sep 20, 2024
This was referenced Sep 21, 2024
ondrejmirtes
requested changes
Sep 22, 2024
Member
There was a problem hiding this comment.
Doesn't have to be just a variable. Getting rid of instanceof like these leads to bugfixes:
- d3a2a92?w=1
- 00d2caf?w=1 (regression tests in a follow-up commit)
Collaborator
|
This pull request has been marked as ready for review. |
Contributor
Author
|
in a followup I will look into implications for $k in |
ondrejmirtes
requested changes
Sep 22, 2024
Member
ondrejmirtes
left a comment
There was a problem hiding this comment.
I think this is solid enough to merge this :) One more thing: regression test for phpstan/phpstan#8559 please.
Member
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes phpstan/phpstan#11716
closes phpstan/phpstan#8559
see https://www.php.net/manual/en/language.types.array.php