diff --git a/src/NodeCompiler/CompileNodeToValue.php b/src/NodeCompiler/CompileNodeToValue.php index 7529f0370..b661d6791 100644 --- a/src/NodeCompiler/CompileNodeToValue.php +++ b/src/NodeCompiler/CompileNodeToValue.php @@ -121,10 +121,7 @@ private function compileConstFetch(Node\Expr\ConstFetch $constNode) */ private function compileClassConstFetch(Node\Expr\ClassConstFetch $node, CompilerContext $context) { - if ($node->class instanceof Node\Expr || $node->name instanceof Node\Expr\Error) { - throw new \LogicException('Found unexpected value when evaluating class constant'); - } - + /** @var Node\Name $node->class */ $className = $node->class->toString(); if ($node->name === 'class') { @@ -143,6 +140,7 @@ private function compileClassConstFetch(Node\Expr\ClassConstFetch $node, Compile $classInfo = $context->getReflector()->reflect($className); } + /** @var string $node->name */ $reflectionConstant = $classInfo->getReflectionConstant($node->name); return $this->__invoke( diff --git a/src/Reflection/Adapter/ReflectionClass.php b/src/Reflection/Adapter/ReflectionClass.php index 10dcd544c..e546e23a5 100644 --- a/src/Reflection/Adapter/ReflectionClass.php +++ b/src/Reflection/Adapter/ReflectionClass.php @@ -178,9 +178,11 @@ public function hasProperty($name) } /** - * {@inheritDoc} + * @param string $name + * + * @return ReflectionProperty|null */ - public function getProperty($name) : ?ReflectionProperty + public function getProperty($name) { $betterReflectionProperty = $this->betterReflectionClass->getProperty($name); diff --git a/src/Reflection/Adapter/ReflectionObject.php b/src/Reflection/Adapter/ReflectionObject.php index bca9007d5..ab5fa9a5a 100644 --- a/src/Reflection/Adapter/ReflectionObject.php +++ b/src/Reflection/Adapter/ReflectionObject.php @@ -169,9 +169,11 @@ public function hasProperty($name) } /** - * {@inheritDoc} + * @param string $name + * + * @return ReflectionProperty|null */ - public function getProperty($name) : ?ReflectionProperty + public function getProperty($name) { $property = $this->betterReflectionObject->getProperty($name); diff --git a/src/Reflection/ReflectionParameter.php b/src/Reflection/ReflectionParameter.php index 5069a5f4d..b44b2f69a 100644 --- a/src/Reflection/ReflectionParameter.php +++ b/src/Reflection/ReflectionParameter.php @@ -184,21 +184,16 @@ private function parseDefaultValueNode() : void $defaultValueNode = $this->node->default; if ($defaultValueNode instanceof Node\Expr\ClassConstFetch) { - if ($defaultValueNode->class instanceof Node\Expr) { - throw new LogicException('Class constant classes cannot be expressions'); - } - - if ($defaultValueNode->name instanceof Node\Expr\Error) { - throw new LogicException('Cannot deal with error nodes'); - } - + /** @var Node\Name $defaultValueNode->class */ $className = $defaultValueNode->class->toString(); if ($className === 'self' || $className === 'static') { + /** @var string $defaultValueNode->name */ $className = $this->findParentClassDeclaringConstant($defaultValueNode->name); } $this->isDefaultValueConstant = true; + /** @var string $defaultValueNode->name */ $this->defaultValueConstantName = $className . '::' . $defaultValueNode->name; }