-
Notifications
You must be signed in to change notification settings - Fork 568
Remove wrong specification #5445
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <?php | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you should log a regular bug for this example and use the bug number as file-name. having a test file named type-specifier might come in our way with autocompletion or other IDE features when searching for the TypeSpecifier class while doing regular development on the codebase
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I renamed it Pr5445, there is no need to open a issue when it's already described in the pr |
||
|
|
||
| namespace BugPr5445; | ||
|
|
||
| use function PHPStan\Testing\assertType; | ||
|
|
||
| /** | ||
| * @param array<string, mixed> $aggregation | ||
| * @param non-falsy-string $type | ||
| */ | ||
| function testTriviallyTrueConditionSkipped(array $aggregation, string $type): void | ||
| { | ||
| if (empty($aggregation['field']) && $type !== 'filter') { | ||
| return; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add 2 more assertions directly after the IF
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
|
|
||
| assertType("array<string, mixed>", $aggregation); | ||
| assertType('non-falsy-string', $type); | ||
|
|
||
| if ($type !== 'filter') { | ||
| assertType("array<string, mixed>", $aggregation); | ||
| } | ||
|
|
||
| assertType('non-falsy-string', $type); | ||
| } | ||
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.
do we need a similar fix in
processBooleanNotSureConditionalTypes?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.
Maybe, but I didn't yet succeed finding a non regression test for
processBooleanNotSureConditionalTypes, so I thought about letting this to another PR.processBooleanNotSureConditionalTypes use
intersectrather thanremoveso it's kinda different.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.
what do you think about https://phpstan.org/r/489d299c-d26b-4dfb-a518-0b793b775a5f ?
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 do agree your example is a bug but the similar changes in processBooleanNotSureConditionalTypes
Does not solve this issue.
I would prefer open an issue about it an run the bot to find a dedicated fix.
This Pr will unlock #5386 which closes ~7 issues
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.
ok - opened a new bug phpstan/phpstan#14455