-
Notifications
You must be signed in to change notification settings - Fork 467
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
Decorate ImpossibleCheckTypeHelper with reason #3579
base: 1.12.x
Are you sure you want to change the base?
Conversation
af42c4a
to
3088f94
Compare
$addTip = function (RuleErrorBuilder $ruleErrorBuilder) use ($scope, $node): RuleErrorBuilder { | ||
$addTip = function (RuleErrorBuilder $ruleErrorBuilder) use ($scope, $node, $reasons): RuleErrorBuilder { | ||
if (count($reasons) > 0) { | ||
return $ruleErrorBuilder->acceptsReasonsTip($reasons); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied 6ac62d3...dc5d8f4#diff-6f5d047ab5b60f37c6dca68882f80e1f7ba2d946e0ffb91290d39589cf55acc2R58-R60
but looking at the failing test, I feel like we want to keep the treatPhpDocTypesAsCertainTip
@ondrejmirtes , no ?
(So maybe the StrictComparisonOfDifferentTypesRule too ?)
Currently I dunno if I need to
- Update the tests.
- Or update this line of code.
Your call.
"• 'publishDate' is not lowercase. | ||
• 'approvedAt' is not lowercase. | ||
• 'allowedValues' is not lowercase.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the comparison is between 'publishDate'|'approvedAt'|'allowedValues'
and lowercase string
, and because of how UnionType::isSuperTypeOfWithReason
works
$result = IsSuperTypeOfResult::createNo()->or(...array_map(static fn (Type $innerType) => $innerType->isSuperTypeOfWithReason($otherType), $this->types));
if ($result->yes()) {
return $result;
}
we have a list with three reasons.
Is it ok for you @ondrejmirtes ?
d012b6a
to
0543a24
Compare
0543a24
to
0087cd2
Compare
This pull request has been marked as ready for review. |
Not sure it's a satisfying solution |
Closes phpstan/phpstan#11799