From 9a9f82d9f44fe4c49ae4d709ca7e3b83a6e6925a Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Fri, 3 Oct 2025 15:41:57 +0200 Subject: [PATCH 1/2] Improve class typehint for reflections --- Reflection/ReflectionClassConstant.php | 4 ++-- Reflection/ReflectionMethod.php | 4 ++-- Reflection/ReflectionProperty.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Reflection/ReflectionClassConstant.php b/Reflection/ReflectionClassConstant.php index cff993397..6b6313358 100644 --- a/Reflection/ReflectionClassConstant.php +++ b/Reflection/ReflectionClassConstant.php @@ -23,7 +23,7 @@ class ReflectionClassConstant implements Reflector public $name; /** - * @var string Fully qualified class name where this constant was defined + * @var class-string Fully qualified class name where this constant was defined */ #[Immutable] #[LanguageLevelTypeAware(['8.1' => 'string'], default: '')] @@ -65,7 +65,7 @@ class ReflectionClassConstant implements Reflector /** * ReflectionClassConstant constructor. * - * @param string|object $class Either a string containing the name of the class to reflect, or an object. + * @param class-string|object $class Either a string containing the name of the class to reflect, or an object. * @param string $constant The name of the class constant. * @since 7.1 * @link https://php.net/manual/en/reflectionclassconstant.construct.php diff --git a/Reflection/ReflectionMethod.php b/Reflection/ReflectionMethod.php index 4cf75448d..7f703dd76 100644 --- a/Reflection/ReflectionMethod.php +++ b/Reflection/ReflectionMethod.php @@ -22,7 +22,7 @@ class ReflectionMethod extends ReflectionFunctionAbstract public $name; /** - * @var string Fully qualified class name where this method was defined + * @var class-string Fully qualified class name where this method was defined */ #[Immutable] #[LanguageLevelTypeAware(['8.1' => 'string'], default: '')] @@ -68,7 +68,7 @@ class ReflectionMethod extends ReflectionFunctionAbstract * * * @link https://php.net/manual/en/reflectionmethod.construct.php - * @param string|object $objectOrMethod Classname, object + * @param class-string|object $objectOrMethod Classname, object * (instance of the class) that contains the method or class name and * method name delimited by ::. * @param string|null $method Name of the method if the first argument is a diff --git a/Reflection/ReflectionProperty.php b/Reflection/ReflectionProperty.php index 9b05662cd..cefe1c35f 100644 --- a/Reflection/ReflectionProperty.php +++ b/Reflection/ReflectionProperty.php @@ -33,7 +33,7 @@ class ReflectionProperty implements Reflector public $name; /** - * @var string Fully qualified class name where this property was defined + * @var class-string Fully qualified class name where this property was defined */ #[Immutable] #[LanguageLevelTypeAware(['8.1' => 'string'], default: '')] @@ -91,7 +91,7 @@ class ReflectionProperty implements Reflector * Construct a ReflectionProperty object * * @link https://php.net/manual/en/reflectionproperty.construct.php - * @param string|object $class The class name, that contains the property. + * @param class-string|object $class The class name, that contains the property. * @param string $property The name of the property being reflected. * @throws ReflectionException if the class or property does not exist. */ From dd422f69876a64ad1d177343eb36c5da8492e855 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Mon, 6 Oct 2025 20:54:31 +0200 Subject: [PATCH 2/2] Remove wrong param --- Reflection/ReflectionMethod.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Reflection/ReflectionMethod.php b/Reflection/ReflectionMethod.php index 7f703dd76..a616666a3 100644 --- a/Reflection/ReflectionMethod.php +++ b/Reflection/ReflectionMethod.php @@ -68,7 +68,7 @@ class ReflectionMethod extends ReflectionFunctionAbstract * * * @link https://php.net/manual/en/reflectionmethod.construct.php - * @param class-string|object $objectOrMethod Classname, object + * @param string|object $objectOrMethod Classname, object * (instance of the class) that contains the method or class name and * method name delimited by ::. * @param string|null $method Name of the method if the first argument is a