-
Notifications
You must be signed in to change notification settings - Fork 63
Fix argument.type PHPStan errors #553
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
76b516b
bfd7ce4
4ca3f87
cdd85e6
082e8fe
15e2682
726a0ad
64edf67
d86463a
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 |
|---|---|---|
|
|
@@ -197,9 +197,12 @@ private function matchedNullableVariableNameToType( | |
| return null; | ||
| } | ||
|
|
||
| $matchedNullableVariableNameToType = $variableNameToTypeCollection->matchByVariableName( | ||
| $this->getName($node->var) | ||
| ); | ||
| $variableName = $this->getName($node->var); | ||
| if ($variableName === null) { | ||
| return null; | ||
| } | ||
|
|
||
| $matchedNullableVariableNameToType = $variableNameToTypeCollection->matchByVariableName($variableName); | ||
|
Member
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. 👍 |
||
|
|
||
| // is the variable we're interested in? | ||
| return null; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| use PhpParser\Node\Expr\ClassConstFetch; | ||
| use PhpParser\Node\Expr\MethodCall; | ||
| use PhpParser\Node\Expr\New_; | ||
| use PhpParser\Node\Name; | ||
| use PhpParser\Node\Scalar; | ||
| use PhpParser\Node\Scalar\String_; | ||
| use PhpParser\Node\Stmt; | ||
|
|
@@ -200,6 +201,10 @@ private function createAnonymousClass(Arg $firstArg): Class_ | |
| throw new NotImplementedYetException(); | ||
| } | ||
|
|
||
| if (! $className instanceof Name) { | ||
|
Member
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. probably need test for
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. yeah, please do this for me. I did not plan to deep dive into this codebase :) |
||
| throw new NotImplementedYetException(); | ||
| } | ||
|
|
||
| // must respect PHPStan anonymous internal naming \Rector\NodeTypeResolver\PHPStan\Scope\PHPStanNodeScopeResolver::ANONYMOUS_CLASS_START_REGEX | ||
| return new Class_('AnonymousClass1234', [ | ||
| 'extends' => $className, | ||
|
|
||
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 argument types were ignored, the root cause for #552 was not detected.