From 651b9d0f4beacd705e1c125e92ee595a28bf00ee Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Thu, 2 Apr 2026 16:54:52 +0300 Subject: [PATCH 1/2] Psalm cleanup --- psalm.xml | 1 + src/ClassConfigFactory.php | 23 ++++------------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/psalm.xml b/psalm.xml index 74ee297..277e73d 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,6 +1,7 @@ getType(); if (!$type) { return null; } - /** - * @psalm-suppress UndefinedClass Needed for PHP 8.0 only, because ReflectionIntersectionType is not supported. - */ return new TypeConfig( name: $this->convertTypeToString($type, $param->getDeclaringClass()?->getName()), allowsNull: $type->allowsNull(), @@ -204,32 +199,22 @@ private function getMethodReturnTypeConfig(ReflectionMethod $method): ?TypeConfi { $returnType = $method->getReturnType(); if (!$returnType && method_exists($method, 'getTentativeReturnType')) { - /** - * Needed for PHP 8.0 only, because getTentativeReturnType() is not supported. - * - * @var ReflectionType|null - * @psalm-suppress UnnecessaryVarAnnotation - */ $returnType = $method->getTentativeReturnType(); } + /** + * @var ReflectionNamedType|ReflectionUnionType|ReflectionIntersectionType|null $returnType + */ if (!$returnType) { return null; } - /** - * @psalm-suppress ArgumentTypeCoercion Needed for PHP 8.0 only, because ReflectionIntersectionType is - * not supported. - */ return new TypeConfig( name: $this->convertTypeToString($returnType, $method->getDeclaringClass()->getName()), allowsNull: $returnType->allowsNull(), ); } - /** - * @psalm-suppress UndefinedClass Needed for PHP 8.0 only, because ReflectionIntersectionType is not supported. - */ private function convertTypeToString( ReflectionNamedType|ReflectionUnionType|ReflectionIntersectionType $type, ?string $declaringClassName = null, From 3c327ed97376611c5fee4bf0153facf77f03a93c Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Thu, 2 Apr 2026 13:55:09 +0000 Subject: [PATCH 2/2] Apply fixes from StyleCI --- src/ClassConfigFactory.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ClassConfigFactory.php b/src/ClassConfigFactory.php index 2266b3c..48da3f7 100644 --- a/src/ClassConfigFactory.php +++ b/src/ClassConfigFactory.php @@ -12,7 +12,6 @@ use ReflectionMethod; use ReflectionNamedType; use ReflectionParameter; -use ReflectionType; use ReflectionUnionType; use Yiisoft\Proxy\Config\ClassConfig; use Yiisoft\Proxy\Config\MethodConfig; @@ -175,7 +174,7 @@ private function getMethodParameterConfig(ReflectionParameter $param): Parameter private function getMethodParameterTypeConfig(ReflectionParameter $param): ?TypeConfig { /** - * @var ReflectionNamedType|ReflectionUnionType|ReflectionIntersectionType|null + * @var ReflectionIntersectionType|ReflectionNamedType|ReflectionUnionType|null */ $type = $param->getType(); if (!$type) { @@ -202,7 +201,7 @@ private function getMethodReturnTypeConfig(ReflectionMethod $method): ?TypeConfi $returnType = $method->getTentativeReturnType(); } /** - * @var ReflectionNamedType|ReflectionUnionType|ReflectionIntersectionType|null $returnType + * @var ReflectionIntersectionType|ReflectionNamedType|ReflectionUnionType|null $returnType */ if (!$returnType) {