Skip to content
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

Merged
merged 6 commits into from
Jan 13, 2017

Conversation

malukenho
Copy link
Collaborator

Linking #240

asgrim
asgrim previously requested changes Jan 9, 2017
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_) {
Copy link
Member

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([
Copy link
Member

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 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was removed

@asgrim asgrim added the bug label Jan 9, 2017
@asgrim asgrim added this to the 1.3.0 milestone Jan 9, 2017
@@ -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_)) {
Copy link
Member

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()) {
Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
$content = '<?php class Foo { public function myMethod(self $param) {} }';

$reflector = new ClassReflector(new AggregateSourceLocator([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was removed

@Ocramius Ocramius dismissed asgrim’s stale review January 13, 2017 11:04

all comments fixed

@Ocramius Ocramius merged commit 3162874 into Roave:master Jan 13, 2017
@Ocramius Ocramius changed the title Fix self hinted ReflectionParameter class reference Fix self and parent hinted ReflectionParameter class reference Jan 13, 2017
@malukenho malukenho deleted the hotfix/#240 branch January 13, 2017 18:26
@asgrim asgrim modified the milestones: 1.3.0, 2.0.0 Mar 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants