-
Notifications
You must be signed in to change notification settings - Fork 426
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
Add non regression tests #1155
Add non regression tests #1155
Conversation
/** @var A[] */ | ||
$y = doFoo(); | ||
|
||
$x = array_fill_keys($y, null); | ||
|
||
assertType('array<string, null>', $x); |
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.
there should not be any code at the top level of a test. please move it into a method (same in other test files)
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.
Sure, but can you explain me why ?
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.
IIRC code on the top level would be executed when running the test suite. but we just want phpstan to analyse it
fb73614
to
5128351
Compare
5128351
to
a553f1e
Compare
Regressions tests added @ondrejmirtes =) |
// Incorrect! This is DOMNode|null not DOMElement|null | ||
// It's also possible to contain a DOMText node, which is not an instance | ||
// of DOMElement, but an instance of DOMNode! | ||
if ($element->firstChild instanceof DOMText) { |
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.
This test would never fail. The error message is: Instanceof between DOMElement|null and DOMText will always evaluate to false.
This test needs to be in ImpossibleInstanceOfRuleTest. Please verify that locally by reverting the stubs update commit. Thanks.
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.
Thank you very much! |
Closes phpstan/phpstan#5846
Closes phpstan/phpstan#6213
Closes phpstan/phpstan#2567 (in the issue 5846)
Closes phpstan/phpstan#2471