mirror of
https://github.com/doctrine/reflection.git
synced 2026-03-24 00:32:07 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b33070b49 | ||
|
|
41a2f0f445 | ||
|
|
d11bac73db | ||
|
|
1c7272c98a |
@@ -19,6 +19,7 @@ use const T_VAR;
|
||||
use const T_VARIABLE;
|
||||
use function array_merge;
|
||||
use function file_get_contents;
|
||||
use function is_array;
|
||||
use function ltrim;
|
||||
use function preg_match;
|
||||
use function sprintf;
|
||||
@@ -189,6 +190,9 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
while (($token = $tokenParser->next()) && $token[0] !== T_STRING) {
|
||||
continue;
|
||||
}
|
||||
if ($token === null) {
|
||||
break;
|
||||
}
|
||||
$methodName = $token[1];
|
||||
$this->docComment['method'][$methodName] = $docComment;
|
||||
$docComment = '';
|
||||
@@ -222,7 +226,7 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
break;
|
||||
}
|
||||
|
||||
$last_token = $token[0];
|
||||
$last_token = is_array($token) ? $token[0] : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class TypedNoDefaultReflectionProperty extends ReflectionProperty
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Checks that a typed property is initialized before accessing its value.
|
||||
* This is neccessary to avoid PHP error "Error: Typed property must not be accessed before initialization".
|
||||
* This is necessary to avoid PHP error "Error: Typed property must not be accessed before initialization".
|
||||
* Should be used only for reflecting typed properties without a default value.
|
||||
*/
|
||||
public function getValue($object = null)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests_PHP74\Common\Reflection\Dummies;
|
||||
|
||||
trait TokenParserAnonymousFunctionTestClass
|
||||
{
|
||||
protected function method()
|
||||
{
|
||||
return static function ($value) {
|
||||
return $value;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests_PHP74\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Reflection\Psr0FindFile;
|
||||
use Doctrine\Common\Reflection\StaticReflectionParser;
|
||||
use Doctrine\Tests_PHP74\Common\Reflection\Dummies\TokenParserAnonymousFunctionTestClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use function strlen;
|
||||
use function substr;
|
||||
|
||||
class TokenParserAnonymousFunctionTest extends TestCase
|
||||
{
|
||||
public function testGetValue() : void
|
||||
{
|
||||
$testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1);
|
||||
$paths = [
|
||||
'Doctrine\\Tests_PHP74' => [$testsRoot],
|
||||
];
|
||||
$staticReflectionParser = new StaticReflectionParser(TokenParserAnonymousFunctionTestClass::class, new Psr0FindFile($paths));
|
||||
|
||||
self::assertEquals('', $staticReflectionParser->getDocComment());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user