Closed
Conversation
0ab86d3 to
9345415
Compare
Contributor
Author
|
@herndlm any opinions on the rule? only the last commit is important. commits 1-3 are pure refactorings, which could land as a separate previous PR, in case ondrej is fine with the approach in general btw: |
staabm
commented
Dec 4, 2024
| [$returnValueType, $iterableAtLeastOnce] = $this->arrayColumnHelper->getReturnValueType($arrayType, $columnKeyType, $scope); | ||
| if ($returnValueType instanceof NeverType || $iterableAtLeastOnce->no()) { | ||
| $errorBuilder = RuleErrorBuilder::message(sprintf( | ||
| 'Cannot access column %s on %s.', |
Contributor
Author
There was a problem hiding this comment.
I think we will need a better message.. maybe mentioning array offsets or property access, but how to name it in unions of array/objects..?
maybe we can find a better generic message
d6812de to
adb4d58
Compare
Member
|
I'm looking forward to this, please rebase this on 2.1.x and mark it as ready so I can review it, thanks. |
Contributor
Author
|
will send separate new PRs |
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#5101
closes phpstan/phpstan#12188
ArrayColumnRule re-uses the logic from the
array_columnreturn type extension and reports problems when the logic implies the result will be a never-type.there are more open problems with
array_columnand I would approach those after this PR got merged