Binary operations on non-empty-string and string should error#1010
Merged
ondrejmirtes merged 12 commits intophpstan:masterfrom Feb 10, 2022
Merged
Binary operations on non-empty-string and string should error#1010ondrejmirtes merged 12 commits intophpstan:masterfrom
non-empty-string and string should error#1010ondrejmirtes merged 12 commits intophpstan:masterfrom
Conversation
Member
|
The right solution here is to introduce |
Contributor
Author
hmm do you mean adding this method on the |
Member
|
It's not a BC break, implementing custom Type isn't covered by BC promise. |
Contributor
Author
ondrejmirtes
requested changes
Feb 10, 2022
src/Analyser/MutatingScope.php
Outdated
Member
There was a problem hiding this comment.
||vs.&&operator priority needs to be disambiguated with parentheses- I don't know why literal-string is mentioned in this condition
Contributor
Author
There was a problem hiding this comment.
- fixed
- I mixed up my mental model in "123" would be a literal-string, but it is also a numeric-string, so the additional check is not necessary. fixed a bug so we don't accept
literal-stringfor binary operations
src/Analyser/MutatingScope.php
Outdated
Member
There was a problem hiding this comment.
||vs.&&operator priority needs to be disambiguated with parentheses- Why
isNonEmptyStringand notisString?
Contributor
Author
There was a problem hiding this comment.
- fixed
- I used
non-empty-stringbecause the initial bug report was about non-emptry-string problems, while it already worked for regularstring.
I am now usingisStringinstead ofisNonEmptyStringin the first block, which renders this second block of changes unnecessary. I removed it.
initially I had a different assumption what this method would provide
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#6624