-
Notifications
You must be signed in to change notification settings - Fork 132
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
Fix self
and parent
hinted ReflectionParameter class reference
#241
Conversation
return null; | ||
} | ||
|
||
if (!$this->reflector instanceof ClassReflector) { | ||
throw new \RuntimeException('Unable to reflect class type because we were not given a ClassReflector'); | ||
} | ||
|
||
if ($hint instanceof Types\Self_) { |
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 can go before the if (!$this->reflector instanceof ClassReflector) {
check
{ | ||
$content = '<?php class Foo { public function myMethod(self $param) {} }'; | ||
|
||
$reflector = new ClassReflector(new AggregateSourceLocator([ |
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.
don't need PhpInternalSourceLocator
do we ?
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.
Was removed
@@ -504,10 +504,14 @@ public function getDefaultValueConstantName() | |||
public function getClass() | |||
{ | |||
$hint = $this->getTypeHint(); | |||
if (!($hint instanceof Types\Object_)) { | |||
if (!($hint instanceof Types\Object_ || $hint instanceof Types\Self_)) { |
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 also be a parent
hint
return $this->getDeclaringClass(); | ||
} | ||
|
||
if ('parent' === $hint->getFqsen()->getName()) { |
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.
Wait, there's no AST node for this? If so, can you please add a comment about it?
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.
Moved to phpDocumentor/TypeResolver#27
{ | ||
$content = '<?php class Foo { public function myMethod(self $param) {} }'; | ||
|
||
$reflector = new ClassReflector(new AggregateSourceLocator([ |
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.
Was removed
self
hinted ReflectionParameter class referenceself
and parent
hinted ReflectionParameter class reference
Linking #240