From 7b0ebf2ccde787ee3af215ea5a4c32d557a57a5a Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Thu, 2 Nov 2017 15:32:42 +0000 Subject: [PATCH 1/4] Prove PHP7.2 issue --- .../Tests/Common/Reflection/StaticReflectionParserTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Doctrine/Tests/Common/Reflection/StaticReflectionParserTest.php b/tests/Doctrine/Tests/Common/Reflection/StaticReflectionParserTest.php index 743971d36..223dccaa6 100644 --- a/tests/Doctrine/Tests/Common/Reflection/StaticReflectionParserTest.php +++ b/tests/Doctrine/Tests/Common/Reflection/StaticReflectionParserTest.php @@ -35,6 +35,7 @@ public function testParentClass($classAnnotationOptimize, $parsedClassName, $exp $staticReflectionParser = new StaticReflectionParser($parsedClassName, new Psr0FindFile($paths), $classAnnotationOptimize); $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); self::assertEquals($expectedClassName, $declaringClassName); + self::assertEquals($parsedClassName, $staticReflectionParser->getReflectionClass()->getName()); } /** From f8fcf6f761cf83661bb3fc209de185bbb16bace2 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Thu, 2 Nov 2017 15:44:24 +0000 Subject: [PATCH 2/4] Fix PHP7.2 --- .../Reflection/StaticReflectionClass.php | 819 +++++++++--------- .../legacy/StaticReflectionClass.php | 433 +++++++++ 2 files changed, 845 insertions(+), 407 deletions(-) create mode 100644 lib/Doctrine/Common/Reflection/legacy/StaticReflectionClass.php diff --git a/lib/Doctrine/Common/Reflection/StaticReflectionClass.php b/lib/Doctrine/Common/Reflection/StaticReflectionClass.php index 2d0f5b007..61ca25206 100644 --- a/lib/Doctrine/Common/Reflection/StaticReflectionClass.php +++ b/lib/Doctrine/Common/Reflection/StaticReflectionClass.php @@ -22,412 +22,417 @@ use ReflectionClass; use ReflectionException; -class StaticReflectionClass extends ReflectionClass -{ - /** - * The static reflection parser object. - * - * @var StaticReflectionParser - */ - private $staticReflectionParser; - - /** - * @param StaticReflectionParser $staticReflectionParser - */ - public function __construct(StaticReflectionParser $staticReflectionParser) - { - $this->staticReflectionParser = $staticReflectionParser; - } - - /** - * {@inheritDoc} - */ - public function getName() - { - return $this->staticReflectionParser->getClassName(); - } - - /** - * {@inheritDoc} - */ - public function getDocComment() - { - return $this->staticReflectionParser->getDocComment(); - } - - /** - * {@inheritDoc} - */ - public function getNamespaceName() - { - return $this->staticReflectionParser->getNamespaceName(); - } - - /** - * @return array - */ - public function getUseStatements() - { - return $this->staticReflectionParser->getUseStatements(); - } - - /** - * {@inheritDoc} - */ - public function getMethod($name) - { - return $this->staticReflectionParser->getReflectionMethod($name); - } - - /** - * {@inheritDoc} - */ - public function getProperty($name) - { - return $this->staticReflectionParser->getReflectionProperty($name); - } - - /** - * {@inheritDoc} - */ - public static function export($argument, $return = false) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getConstant($name) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getConstants() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getConstructor() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getDefaultProperties() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getEndLine() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getExtension() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getExtensionName() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getFileName() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getInterfaceNames() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getInterfaces() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getMethods($filter = null) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getModifiers() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getParentClass() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getProperties($filter = null) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getShortName() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getStartLine() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getStaticProperties() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getStaticPropertyValue($name, $default = '') - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getTraitAliases() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getTraitNames() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getTraits() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function hasConstant($name) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function hasMethod($name) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function hasProperty($name) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function implementsInterface($interface) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function inNamespace() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isAbstract() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isCloneable() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isFinal() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isInstance($object) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isInstantiable() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isInterface() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isInternal() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isIterateable() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isSubclassOf($class) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isTrait() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isUserDefined() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function newInstance($args) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function newInstanceArgs(array $args = []) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function newInstanceWithoutConstructor() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function setStaticPropertyValue($name, $value) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function __toString() - { - throw new ReflectionException('Method not implemented'); +if (version_compare(phpversion(), '7.2', '<')) { + include __DIR__ . '/legacy/StaticReflectionClass.php'; +} +else { + class StaticReflectionClass extends ReflectionClass + { + /** + * The static reflection parser object. + * + * @var StaticReflectionParser + */ + private $staticReflectionParser; + + /** + * @param StaticReflectionParser $staticReflectionParser + */ + public function __construct(StaticReflectionParser $staticReflectionParser) + { + $this->staticReflectionParser = $staticReflectionParser; + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return $this->staticReflectionParser->getClassName(); + } + + /** + * {@inheritDoc} + */ + public function getDocComment() + { + return $this->staticReflectionParser->getDocComment(); + } + + /** + * {@inheritDoc} + */ + public function getNamespaceName() + { + return $this->staticReflectionParser->getNamespaceName(); + } + + /** + * @return array + */ + public function getUseStatements() + { + return $this->staticReflectionParser->getUseStatements(); + } + + /** + * {@inheritDoc} + */ + public function getMethod($name) + { + return $this->staticReflectionParser->getReflectionMethod($name); + } + + /** + * {@inheritDoc} + */ + public function getProperty($name) + { + return $this->staticReflectionParser->getReflectionProperty($name); + } + + /** + * {@inheritDoc} + */ + public static function export($argument, $return = false) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getConstant($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getConstants() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getConstructor() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getDefaultProperties() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getEndLine() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getExtension() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getExtensionName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getFileName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getInterfaceNames() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getInterfaces() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getMethods($filter = null) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getModifiers() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getParentClass() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getProperties($filter = null) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getShortName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStartLine() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStaticProperties() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStaticPropertyValue($name, $default = '') + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getTraitAliases() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getTraitNames() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getTraits() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function hasConstant($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function hasMethod($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function hasProperty($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function implementsInterface($interface) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function inNamespace() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isAbstract() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isCloneable() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isFinal() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInstance($object) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInstantiable() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInterface() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInternal() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isIterateable() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isSubclassOf($class) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isTrait() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isUserDefined() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function newInstance(...$args) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function newInstanceArgs(array $args = []) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function newInstanceWithoutConstructor() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function setStaticPropertyValue($name, $value) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function __toString() + { + throw new ReflectionException('Method not implemented'); + } } } diff --git a/lib/Doctrine/Common/Reflection/legacy/StaticReflectionClass.php b/lib/Doctrine/Common/Reflection/legacy/StaticReflectionClass.php new file mode 100644 index 000000000..2d0f5b007 --- /dev/null +++ b/lib/Doctrine/Common/Reflection/legacy/StaticReflectionClass.php @@ -0,0 +1,433 @@ +. + */ + +namespace Doctrine\Common\Reflection; + +use ReflectionClass; +use ReflectionException; + +class StaticReflectionClass extends ReflectionClass +{ + /** + * The static reflection parser object. + * + * @var StaticReflectionParser + */ + private $staticReflectionParser; + + /** + * @param StaticReflectionParser $staticReflectionParser + */ + public function __construct(StaticReflectionParser $staticReflectionParser) + { + $this->staticReflectionParser = $staticReflectionParser; + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return $this->staticReflectionParser->getClassName(); + } + + /** + * {@inheritDoc} + */ + public function getDocComment() + { + return $this->staticReflectionParser->getDocComment(); + } + + /** + * {@inheritDoc} + */ + public function getNamespaceName() + { + return $this->staticReflectionParser->getNamespaceName(); + } + + /** + * @return array + */ + public function getUseStatements() + { + return $this->staticReflectionParser->getUseStatements(); + } + + /** + * {@inheritDoc} + */ + public function getMethod($name) + { + return $this->staticReflectionParser->getReflectionMethod($name); + } + + /** + * {@inheritDoc} + */ + public function getProperty($name) + { + return $this->staticReflectionParser->getReflectionProperty($name); + } + + /** + * {@inheritDoc} + */ + public static function export($argument, $return = false) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getConstant($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getConstants() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getConstructor() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getDefaultProperties() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getEndLine() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getExtension() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getExtensionName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getFileName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getInterfaceNames() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getInterfaces() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getMethods($filter = null) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getModifiers() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getParentClass() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getProperties($filter = null) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getShortName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStartLine() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStaticProperties() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStaticPropertyValue($name, $default = '') + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getTraitAliases() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getTraitNames() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getTraits() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function hasConstant($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function hasMethod($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function hasProperty($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function implementsInterface($interface) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function inNamespace() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isAbstract() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isCloneable() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isFinal() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInstance($object) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInstantiable() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInterface() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInternal() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isIterateable() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isSubclassOf($class) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isTrait() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isUserDefined() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function newInstance($args) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function newInstanceArgs(array $args = []) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function newInstanceWithoutConstructor() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function setStaticPropertyValue($name, $value) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function __toString() + { + throw new ReflectionException('Method not implemented'); + } +} From 9eda1363c2d6df1658f802d694896c23bfca69e2 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Thu, 2 Nov 2017 15:59:41 +0000 Subject: [PATCH 3/4] Use a trait instead for easier to understand code --- .../Reflection/StaticReflectionClass.php | 816 +++++++++--------- .../Reflection/StaticReflectionClassTrait.php | 47 + .../legacy/StaticReflectionClass.php | 433 ---------- 3 files changed, 451 insertions(+), 845 deletions(-) create mode 100644 lib/Doctrine/Common/Reflection/StaticReflectionClassTrait.php delete mode 100644 lib/Doctrine/Common/Reflection/legacy/StaticReflectionClass.php diff --git a/lib/Doctrine/Common/Reflection/StaticReflectionClass.php b/lib/Doctrine/Common/Reflection/StaticReflectionClass.php index 61ca25206..f8e2b2864 100644 --- a/lib/Doctrine/Common/Reflection/StaticReflectionClass.php +++ b/lib/Doctrine/Common/Reflection/StaticReflectionClass.php @@ -22,417 +22,409 @@ use ReflectionClass; use ReflectionException; -if (version_compare(phpversion(), '7.2', '<')) { - include __DIR__ . '/legacy/StaticReflectionClass.php'; -} -else { - class StaticReflectionClass extends ReflectionClass - { - /** - * The static reflection parser object. - * - * @var StaticReflectionParser - */ - private $staticReflectionParser; - - /** - * @param StaticReflectionParser $staticReflectionParser - */ - public function __construct(StaticReflectionParser $staticReflectionParser) - { - $this->staticReflectionParser = $staticReflectionParser; - } - - /** - * {@inheritDoc} - */ - public function getName() - { - return $this->staticReflectionParser->getClassName(); - } - - /** - * {@inheritDoc} - */ - public function getDocComment() - { - return $this->staticReflectionParser->getDocComment(); - } - - /** - * {@inheritDoc} - */ - public function getNamespaceName() - { - return $this->staticReflectionParser->getNamespaceName(); - } - - /** - * @return array - */ - public function getUseStatements() - { - return $this->staticReflectionParser->getUseStatements(); - } - - /** - * {@inheritDoc} - */ - public function getMethod($name) - { - return $this->staticReflectionParser->getReflectionMethod($name); - } - - /** - * {@inheritDoc} - */ - public function getProperty($name) - { - return $this->staticReflectionParser->getReflectionProperty($name); - } - - /** - * {@inheritDoc} - */ - public static function export($argument, $return = false) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getConstant($name) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getConstants() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getConstructor() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getDefaultProperties() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getEndLine() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getExtension() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getExtensionName() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getFileName() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getInterfaceNames() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getInterfaces() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getMethods($filter = null) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getModifiers() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getParentClass() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getProperties($filter = null) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getShortName() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getStartLine() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getStaticProperties() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getStaticPropertyValue($name, $default = '') - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getTraitAliases() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getTraitNames() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getTraits() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function hasConstant($name) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function hasMethod($name) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function hasProperty($name) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function implementsInterface($interface) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function inNamespace() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isAbstract() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isCloneable() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isFinal() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isInstance($object) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isInstantiable() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isInterface() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isInternal() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isIterateable() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isSubclassOf($class) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isTrait() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isUserDefined() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function newInstance(...$args) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function newInstanceArgs(array $args = []) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function newInstanceWithoutConstructor() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function setStaticPropertyValue($name, $value) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function __toString() - { - throw new ReflectionException('Method not implemented'); - } +class StaticReflectionClass extends ReflectionClass +{ + /** + * \ReflectionClass has a different signature in PHP7.1 and earlier. + */ + use StaticReflectionClassTrait; + + /** + * The static reflection parser object. + * + * @var StaticReflectionParser + */ + private $staticReflectionParser; + + /** + * @param StaticReflectionParser $staticReflectionParser + */ + public function __construct(StaticReflectionParser $staticReflectionParser) + { + $this->staticReflectionParser = $staticReflectionParser; + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return $this->staticReflectionParser->getClassName(); + } + + /** + * {@inheritDoc} + */ + public function getDocComment() + { + return $this->staticReflectionParser->getDocComment(); + } + + /** + * {@inheritDoc} + */ + public function getNamespaceName() + { + return $this->staticReflectionParser->getNamespaceName(); + } + + /** + * @return array + */ + public function getUseStatements() + { + return $this->staticReflectionParser->getUseStatements(); + } + + /** + * {@inheritDoc} + */ + public function getMethod($name) + { + return $this->staticReflectionParser->getReflectionMethod($name); + } + + /** + * {@inheritDoc} + */ + public function getProperty($name) + { + return $this->staticReflectionParser->getReflectionProperty($name); + } + + /** + * {@inheritDoc} + */ + public static function export($argument, $return = false) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getConstant($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getConstants() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getConstructor() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getDefaultProperties() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getEndLine() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getExtension() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getExtensionName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getFileName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getInterfaceNames() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getInterfaces() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getMethods($filter = null) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getModifiers() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getParentClass() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getProperties($filter = null) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getShortName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStartLine() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStaticProperties() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStaticPropertyValue($name, $default = '') + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getTraitAliases() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getTraitNames() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getTraits() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function hasConstant($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function hasMethod($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function hasProperty($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function implementsInterface($interface) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function inNamespace() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isAbstract() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isCloneable() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isFinal() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInstance($object) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInstantiable() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInterface() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInternal() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isIterateable() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isSubclassOf($class) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isTrait() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isUserDefined() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function newInstanceArgs(array $args = []) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function newInstanceWithoutConstructor() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function setStaticPropertyValue($name, $value) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function __toString() + { + throw new ReflectionException('Method not implemented'); } } diff --git a/lib/Doctrine/Common/Reflection/StaticReflectionClassTrait.php b/lib/Doctrine/Common/Reflection/StaticReflectionClassTrait.php new file mode 100644 index 000000000..99e67f773 --- /dev/null +++ b/lib/Doctrine/Common/Reflection/StaticReflectionClassTrait.php @@ -0,0 +1,47 @@ +. + */ + +namespace Doctrine\Common\Reflection; + +use ReflectionException; + +if (version_compare(phpversion(), '7.2', '<')) { + trait StaticReflectionClassTrait + { + /** + * @see \ReflectionClass::newInstance() + */ + public function newInstance($args) + { + throw new ReflectionException('Method not implemented'); + } + } +} +else { + trait StaticReflectionClassTrait + { + /** + * @see \ReflectionClass::newInstance() + */ + public function newInstance(...$args) + { + throw new ReflectionException('Method not implemented'); + } + } +} diff --git a/lib/Doctrine/Common/Reflection/legacy/StaticReflectionClass.php b/lib/Doctrine/Common/Reflection/legacy/StaticReflectionClass.php deleted file mode 100644 index 2d0f5b007..000000000 --- a/lib/Doctrine/Common/Reflection/legacy/StaticReflectionClass.php +++ /dev/null @@ -1,433 +0,0 @@ -. - */ - -namespace Doctrine\Common\Reflection; - -use ReflectionClass; -use ReflectionException; - -class StaticReflectionClass extends ReflectionClass -{ - /** - * The static reflection parser object. - * - * @var StaticReflectionParser - */ - private $staticReflectionParser; - - /** - * @param StaticReflectionParser $staticReflectionParser - */ - public function __construct(StaticReflectionParser $staticReflectionParser) - { - $this->staticReflectionParser = $staticReflectionParser; - } - - /** - * {@inheritDoc} - */ - public function getName() - { - return $this->staticReflectionParser->getClassName(); - } - - /** - * {@inheritDoc} - */ - public function getDocComment() - { - return $this->staticReflectionParser->getDocComment(); - } - - /** - * {@inheritDoc} - */ - public function getNamespaceName() - { - return $this->staticReflectionParser->getNamespaceName(); - } - - /** - * @return array - */ - public function getUseStatements() - { - return $this->staticReflectionParser->getUseStatements(); - } - - /** - * {@inheritDoc} - */ - public function getMethod($name) - { - return $this->staticReflectionParser->getReflectionMethod($name); - } - - /** - * {@inheritDoc} - */ - public function getProperty($name) - { - return $this->staticReflectionParser->getReflectionProperty($name); - } - - /** - * {@inheritDoc} - */ - public static function export($argument, $return = false) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getConstant($name) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getConstants() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getConstructor() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getDefaultProperties() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getEndLine() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getExtension() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getExtensionName() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getFileName() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getInterfaceNames() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getInterfaces() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getMethods($filter = null) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getModifiers() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getParentClass() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getProperties($filter = null) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getShortName() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getStartLine() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getStaticProperties() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getStaticPropertyValue($name, $default = '') - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getTraitAliases() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getTraitNames() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function getTraits() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function hasConstant($name) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function hasMethod($name) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function hasProperty($name) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function implementsInterface($interface) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function inNamespace() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isAbstract() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isCloneable() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isFinal() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isInstance($object) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isInstantiable() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isInterface() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isInternal() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isIterateable() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isSubclassOf($class) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isTrait() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function isUserDefined() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function newInstance($args) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function newInstanceArgs(array $args = []) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function newInstanceWithoutConstructor() - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function setStaticPropertyValue($name, $value) - { - throw new ReflectionException('Method not implemented'); - } - - /** - * {@inheritDoc} - */ - public function __toString() - { - throw new ReflectionException('Method not implemented'); - } -} From 2f3ee4785d4caab7814dedcff85d986483b05f02 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Thu, 2 Nov 2017 16:02:50 +0000 Subject: [PATCH 4/4] Thanks @ocramius --- .../Reflection/StaticReflectionClass.php | 13 +++-- .../Reflection/StaticReflectionClassTrait.php | 47 ------------------- 2 files changed, 8 insertions(+), 52 deletions(-) delete mode 100644 lib/Doctrine/Common/Reflection/StaticReflectionClassTrait.php diff --git a/lib/Doctrine/Common/Reflection/StaticReflectionClass.php b/lib/Doctrine/Common/Reflection/StaticReflectionClass.php index f8e2b2864..9d650ec75 100644 --- a/lib/Doctrine/Common/Reflection/StaticReflectionClass.php +++ b/lib/Doctrine/Common/Reflection/StaticReflectionClass.php @@ -24,11 +24,6 @@ class StaticReflectionClass extends ReflectionClass { - /** - * \ReflectionClass has a different signature in PHP7.1 and earlier. - */ - use StaticReflectionClassTrait; - /** * The static reflection parser object. * @@ -396,6 +391,14 @@ public function isUserDefined() throw new ReflectionException('Method not implemented'); } + /** + * {@inheritDoc} + */ + public function newInstance($arg = null, ...$args) + { + throw new ReflectionException('Method not implemented'); + } + /** * {@inheritDoc} */ diff --git a/lib/Doctrine/Common/Reflection/StaticReflectionClassTrait.php b/lib/Doctrine/Common/Reflection/StaticReflectionClassTrait.php deleted file mode 100644 index 99e67f773..000000000 --- a/lib/Doctrine/Common/Reflection/StaticReflectionClassTrait.php +++ /dev/null @@ -1,47 +0,0 @@ -. - */ - -namespace Doctrine\Common\Reflection; - -use ReflectionException; - -if (version_compare(phpversion(), '7.2', '<')) { - trait StaticReflectionClassTrait - { - /** - * @see \ReflectionClass::newInstance() - */ - public function newInstance($args) - { - throw new ReflectionException('Method not implemented'); - } - } -} -else { - trait StaticReflectionClassTrait - { - /** - * @see \ReflectionClass::newInstance() - */ - public function newInstance(...$args) - { - throw new ReflectionException('Method not implemented'); - } - } -}