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

Provide a fix for issue #70 #72

Merged
merged 1 commit 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
4 changes: 3 additions & 1 deletion src/Scanner/TokenArrayScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,9 @@ protected function scan()
&& $infos[$infoIndex]['type'] === 'class'
|| ($tokenType === T_FUNCTION && $infos[$infoIndex]['type'] === 'function'))
) {
$infos[$infoIndex]['shortName'] = $tokens[$tokenIndex + 2][1];
$infos[$infoIndex]['shortName'] = is_array($tokens[$tokenIndex + 2])
? $tokens[$tokenIndex + 2][1]
: $tokens[$tokenIndex + 2];
$infos[$infoIndex]['name'] = (($namespace !== null)
? $namespace . '\\'
: '') . $infos[$infoIndex]['shortName'];
Expand Down
12 changes: 12 additions & 0 deletions test/Reflection/FileReflectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,16 @@ public function testFileCanReflectFileWithUses()
];
$this->assertSame($expected, $reflectionFile->getUses());
}

/**
* @group 70
* @group 43
*/
public function testFileReflectionShouldNotRaiseNoticesWhenReflectingClosures()
{
require_once __DIR__ . '/TestAsset/issue-70.php';
$r = new FileReflection(__DIR__ . '/TestAsset/issue-70.php');
$this->assertContains('spl_autoload_register', $r->getContents());
$this->assertContains('function ()', $r->getContents());
}
}
9 changes: 9 additions & 0 deletions test/Reflection/TestAsset/issue-70.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
/**
* @link http://github.com/zendframework/zend-code for the canonical source repository
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

spl_autoload_register(function () {
});