[NodeTypeResolver] add method argument type

This commit is contained in:
TomasVotruba 2017-08-21 12:04:35 +02:00
parent 9c9b5c8111
commit 8c3fc9a493
2 changed files with 21 additions and 20 deletions

View File

@ -35,28 +35,31 @@ final class PropertyTest extends AbstractContainerAwareTestCase
$this->nodes = $this->standaloneTraverseNodeTraverser->traverse($nodes);
}
// /**
// * $this->property;
// */
// public function testPropertyFetch(): void
// {
// /** @var PropertyFetch $propertyFetchNode */
// $propertyFetchNode = $this->nodes[1]->stmts[1]->stmts[2]->stmts[0]->expr;
// $this->assertSame(Html::class, $propertyFetchNode->getAttribute('type'));
// }
/**
* $this->property;.
*/
public function testPropertyFetch(): void
{
/** @var PropertyFetch $propertyFetchNode */
$propertyFetchNode = $this->nodes[1]->stmts[1]->stmts[2]->stmts[0]->expr;
$this->assertSame(Html::class, $propertyFetchNode->getAttribute('type'));
}
/**
* $property;
* $property;.
*/
public function testProperty(): void
{
$propertyNode = $this->nodes[1]->stmts[1]->stmts[0];
$this->assertSame(Html::class, $propertyNode->getAttribute('type'));
}
//
// public function testMethodParameter(): void
// {
// $this->assertTrue(true);
// // $constructorVariableNode = $this->nodes[1]->stmts[1]->stmts[1]->params[0]->var;
// }
/**
* method(Type $parameter).
*/
public function testMethodParameter(): void
{
$constructorVariableNode = $this->nodes[1]->stmts[1]->stmts[1]->params[0]->var;
$this->assertSame(Html::class, $constructorVariableNode->getAttribute('type'));
}
}

View File

@ -36,24 +36,22 @@ final class VariableTest extends AbstractContainerAwareTestCase
}
/**
* $variable
* $variable.
*/
public function testVariable(): void
{
/** @var Variable $htmlVariableNode */
$htmlVariableNode = $this->nodes[1]->stmts[1]->stmts[0]->stmts[0]->expr->var;
$this->assertSame(Html::class, $htmlVariableNode->getAttribute('type'));
}
/**
* $newVariable = $variable;
* $newVariable = $variable;.
*/
public function testReassignedVariable(): void
{
/** @var Variable $assignedVariableNode */
$assignedVariableNode = $this->nodes[1]->stmts[1]->stmts[0]->stmts[1]->expr->var;
$this->assertSame(Html::class, $assignedVariableNode->getAttribute('type'));
}
}