From: Michele Locati Date: Thu, 17 Mar 2022 09:05:19 +0100 Subject: [PATCH] Fix PHP 8.1 compatibility --- a/src/Reflection/ClassReflection.php +++ b/src/Reflection/ClassReflection.php @@ -101,6 +101,7 @@ class ClassReflection extends ReflectionClass implements ReflectionInterface * @param bool $includeDocComment * @return int */ + #[\ReturnTypeWillChange] public function getStartLine($includeDocComment = false) { if ($includeDocComment && $this->getDocComment() != '') { @@ -140,6 +141,7 @@ class ClassReflection extends ReflectionClass implements ReflectionInterface * * @return ClassReflection[] */ + #[\ReturnTypeWillChange] public function getInterfaces() { $phpReflections = parent::getInterfaces(); @@ -160,6 +162,7 @@ class ClassReflection extends ReflectionClass implements ReflectionInterface * @param string $name * @return MethodReflection */ + #[\ReturnTypeWillChange] public function getMethod($name) { $method = new MethodReflection($this->getName(), parent::getMethod($name)->getName()); @@ -173,6 +176,7 @@ class ClassReflection extends ReflectionClass implements ReflectionInterface * @param int $filter * @return MethodReflection[] */ + #[\ReturnTypeWillChange] public function getMethods($filter = -1) { $methods = []; @@ -189,6 +193,7 @@ class ClassReflection extends ReflectionClass implements ReflectionInterface * * @return null|array */ + #[\ReturnTypeWillChange] public function getTraits() { $vals = []; @@ -209,6 +214,7 @@ class ClassReflection extends ReflectionClass implements ReflectionInterface * * @return ClassReflection|bool */ + #[\ReturnTypeWillChange] public function getParentClass() { $phpReflection = parent::getParentClass(); @@ -228,6 +234,7 @@ class ClassReflection extends ReflectionClass implements ReflectionInterface * @param string $name * @return PropertyReflection */ + #[\ReturnTypeWillChange] public function getProperty($name) { $phpReflection = parent::getProperty($name); @@ -243,6 +250,7 @@ class ClassReflection extends ReflectionClass implements ReflectionInterface * @param int $filter * @return PropertyReflection[] */ + #[\ReturnTypeWillChange] public function getProperties($filter = -1) { $phpReflections = parent::getProperties($filter); --- a/src/Reflection/FunctionReflection.php +++ b/src/Reflection/FunctionReflection.php @@ -62,6 +62,7 @@ class FunctionReflection extends ReflectionFunction implements ReflectionInterfa * @param bool $includeDocComment * @return int */ + #[\ReturnTypeWillChange] public function getStartLine($includeDocComment = false) { if ($includeDocComment) { @@ -186,6 +187,7 @@ class FunctionReflection extends ReflectionFunction implements ReflectionInterfa * * @return ParameterReflection[] */ + #[\ReturnTypeWillChange] public function getParameters() { $phpReflections = parent::getParameters(); --- a/src/Reflection/MethodReflection.php +++ b/src/Reflection/MethodReflection.php @@ -93,6 +93,7 @@ class MethodReflection extends PhpReflectionMethod implements ReflectionInterfac * @param bool $includeDocComment * @return int */ + #[\ReturnTypeWillChange] public function getStartLine($includeDocComment = false) { if ($includeDocComment) { @@ -109,6 +110,7 @@ class MethodReflection extends PhpReflectionMethod implements ReflectionInterfac * * @return ClassReflection */ + #[\ReturnTypeWillChange] public function getDeclaringClass() { $phpReflection = parent::getDeclaringClass(); @@ -118,12 +120,7 @@ class MethodReflection extends PhpReflectionMethod implements ReflectionInterfac return $laminasReflection; } - /** - * Get method prototype - * - * @param string $format - * @return array|string - */ + #[\ReturnTypeWillChange] public function getPrototype($format = MethodReflection::PROTOTYPE_AS_ARRAY) { $returnType = 'mixed'; @@ -180,6 +177,7 @@ class MethodReflection extends PhpReflectionMethod implements ReflectionInterfac * * @return ParameterReflection[] */ + #[\ReturnTypeWillChange] public function getParameters() { $phpReflections = parent::getParameters(); --- a/src/Reflection/ParameterReflection.php +++ b/src/Reflection/ParameterReflection.php @@ -24,6 +24,7 @@ class ParameterReflection extends ReflectionParameter implements ReflectionInter * * @return ClassReflection */ + #[\ReturnTypeWillChange] public function getDeclaringClass() { $phpReflection = parent::getDeclaringClass(); @@ -38,6 +39,7 @@ class ParameterReflection extends ReflectionParameter implements ReflectionInter * * @return null|ClassReflection */ + #[\ReturnTypeWillChange] public function getClass() { $phpReflection = parent::getClass(); @@ -56,6 +58,7 @@ class ParameterReflection extends ReflectionParameter implements ReflectionInter * * @return FunctionReflection|MethodReflection */ + #[\ReturnTypeWillChange] public function getDeclaringFunction() { $phpReflection = parent::getDeclaringFunction(); --- a/src/Reflection/PropertyReflection.php +++ b/src/Reflection/PropertyReflection.php @@ -28,6 +28,7 @@ class PropertyReflection extends PhpReflectionProperty implements ReflectionInte * * @return ClassReflection */ + #[\ReturnTypeWillChange] public function getDeclaringClass() { $phpReflection = parent::getDeclaringClass(); @@ -42,6 +43,7 @@ class PropertyReflection extends PhpReflectionProperty implements ReflectionInte * * @return string|false False if no DocBlock defined */ + #[\ReturnTypeWillChange] public function getDocComment() { return parent::getDocComment();