From 11b29d39950384485eeb5a551d125e90cc8eee7c Mon Sep 17 00:00:00 2001 From: Serhii Puchkovskyi Date: Thu, 8 Sep 2022 11:58:11 +0300 Subject: [PATCH] Apply a patch to fix doctrine/reflection php8 compatibility issue. --- .../Compatibility/Php7/ReflectionClass.php | 24 ++++++++++++++++++ .../Compatibility/Php7/ReflectionMethod.php | 16 ++++++++++++ .../Compatibility/Php8/ReflectionClass.php | 25 +++++++++++++++++++ .../Compatibility/Php8/ReflectionMethod.php | 16 ++++++++++++ .../Compatibility/ReflectionClass.php | 18 +++++++++++++ .../Compatibility/ReflectionMethod.php | 19 ++++++++++++++ .../Reflection/StaticReflectionClass.php | 19 +++----------- .../Reflection/StaticReflectionMethod.php | 11 +++----- 8 files changed, 124 insertions(+), 24 deletions(-) create mode 100644 lib/doctrine/common/lib/Doctrine/Common/Reflection/Compatibility/Php7/ReflectionClass.php create mode 100644 lib/doctrine/common/lib/Doctrine/Common/Reflection/Compatibility/Php7/ReflectionMethod.php create mode 100644 lib/doctrine/common/lib/Doctrine/Common/Reflection/Compatibility/Php8/ReflectionClass.php create mode 100644 lib/doctrine/common/lib/Doctrine/Common/Reflection/Compatibility/Php8/ReflectionMethod.php create mode 100644 lib/doctrine/common/lib/Doctrine/Common/Reflection/Compatibility/ReflectionClass.php create mode 100644 lib/doctrine/common/lib/Doctrine/Common/Reflection/Compatibility/ReflectionMethod.php diff --git a/lib/doctrine/common/lib/Doctrine/Common/Reflection/Compatibility/Php7/ReflectionClass.php b/lib/doctrine/common/lib/Doctrine/Common/Reflection/Compatibility/Php7/ReflectionClass.php new file mode 100644 index 0000000..ec4c180 --- /dev/null +++ b/lib/doctrine/common/lib/Doctrine/Common/Reflection/Compatibility/Php7/ReflectionClass.php @@ -0,0 +1,24 @@ += 80000) { + class_alias('Doctrine\Common\Reflection\Compatibility\Php8\ReflectionClass', 'Doctrine\Common\Reflection\Compatibility\ReflectionClass'); +} else { + class_alias('Doctrine\Common\Reflection\Compatibility\Php7\ReflectionClass', 'Doctrine\Common\Reflection\Compatibility\ReflectionClass'); +} + +if (false) { + class ReflectionClass + { + } +} diff --git a/lib/doctrine/common/lib/Doctrine/Common/Reflection/Compatibility/ReflectionMethod.php b/lib/doctrine/common/lib/Doctrine/Common/Reflection/Compatibility/ReflectionMethod.php new file mode 100644 index 0000000..5971206 --- /dev/null +++ b/lib/doctrine/common/lib/Doctrine/Common/Reflection/Compatibility/ReflectionMethod.php @@ -0,0 +1,19 @@ + += 80000) { + class_alias('Doctrine\Common\Reflection\Compatibility\Php8\ReflectionMethod', 'Doctrine\Common\Reflection\Compatibility\ReflectionMethod'); +} else { + class_alias('Doctrine\Common\Reflection\Compatibility\Php7\ReflectionMethod', 'Doctrine\Common\Reflection\Compatibility\ReflectionMethod'); +} + +if (false) { + class ReflectionMethod + { + } +} diff --git a/lib/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php b/lib/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php index b65979a..a2cebe5 100644 --- a/lib/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php +++ b/lib/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php @@ -19,11 +19,14 @@ namespace Doctrine\Common\Reflection; +use Doctrine\Common\Reflection\Compatibility\ReflectionClass as CompatibilityReflectionClass; use ReflectionClass; use ReflectionException; class StaticReflectionClass extends ReflectionClass { + use CompatibilityReflectionClass; + /** * The static reflection parser object. * @@ -103,14 +106,6 @@ public function getConstant($name) throw new ReflectionException('Method not implemented'); } - /** - * {@inheritDoc} - */ - public function getConstants() - { - throw new ReflectionException('Method not implemented'); - } - /** * {@inheritDoc} */ @@ -391,14 +386,6 @@ public function isUserDefined() throw new ReflectionException('Method not implemented'); } - /** - * {@inheritDoc} - */ - public function newInstance($args) - { - throw new ReflectionException('Method not implemented'); - } - /** * {@inheritDoc} */ diff --git a/lib/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php b/lib/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php index 8d5380b..b5e5d5f 100644 --- a/lib/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php +++ b/lib/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php @@ -19,11 +19,14 @@ namespace Doctrine\Common\Reflection; +use Doctrine\Common\Reflection\Compatibility\ReflectionMethod as CompatibilityReflectionMethod; use ReflectionException; use ReflectionMethod; class StaticReflectionMethod extends ReflectionMethod { + use CompatibilityReflectionMethod; + /** * The PSR-0 parser object. * @@ -128,14 +131,6 @@ public function getPrototype() throw new ReflectionException('Method not implemented'); } - /** - * {@inheritDoc} - */ - public function invoke($object, $parameter = null) - { - throw new ReflectionException('Method not implemented'); - } - /** * {@inheritDoc} */