Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Fix handling of FQCNs in method parameters #61

Merged
merged 2 commits into from
Jun 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Scanner/MethodScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,13 @@ protected function scan()
goto SCANNER_CONTINUE_SIGNATURE;
// goto (no break needed);

case T_NS_SEPARATOR:
if (!isset($infos[$infoIndex])) {
$MACRO_INFO_START();
}
goto SCANNER_CONTINUE_SIGNATURE;
// goto (no break needed);

case T_VARIABLE:
case T_STRING:
if ($tokenType === T_STRING && $parentCount === 0) {
Expand Down
2 changes: 1 addition & 1 deletion test/Scanner/ClassScannerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function testClassScannerCanReturnLineNumbers()
$file = new FileScanner(__DIR__ . '/../TestAsset/BarClass.php');
$class = $file->getClass('ZendTest\Code\TestAsset\BarClass');
$this->assertEquals(10, $class->getLineStart());
$this->assertEquals(37, $class->getLineEnd());
$this->assertEquals(42, $class->getLineEnd());
}

public function testClassScannerCanScanAnnotations()
Expand Down
10 changes: 10 additions & 0 deletions test/Scanner/MethodScannerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ public function testMethodScannerReturnsParameterScanner()
$this->assertEquals('t', $parameter->getName());
}

public function testMethodScannerParsesClassNames()
{
$file = new FileScanner(__DIR__ . '/../TestAsset/BarClass.php');
$class = $file->getClass('ZendTest\Code\TestAsset\BarClass');
$method = $class->getMethod('five');
$this->assertEquals(['a'], $method->getParameters());
$parameter = $method->getParameter('a');
$this->assertEquals('ZendTest\Code\TestAsset\AbstractClass', $parameter->getClass());
}

public function testMethodScannerReturnsPropertyWithNoDefault()
{
$file = new FileScanner(__DIR__ . '/../TestAsset/BazClass.php');
Expand Down
5 changes: 5 additions & 0 deletions test/TestAsset/BarClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ protected function four($one, $two = array(array(array('default'))))
{
// four
}

private function five(\ZendTest\Code\TestAsset\AbstractClass $a)
{
// five
}
}