From 156b60ff556529e3f916a2e0d4dacba394d256c8 Mon Sep 17 00:00:00 2001 From: Robert Lemke Date: Wed, 7 Jun 2023 12:52:47 +0200 Subject: [PATCH 1/2] Fix generating null return type from reflection in TypeGenerator The TypeGenerator failed with "type 'null' cannot be nullable" when `fromReflectionType()` was called for a method with a return type "null" due to a incorrect comparison with the string "null". This change corrects the comparison so that such methods are reflected without errors. Obvious fix. --- src/Generator/TypeGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator/TypeGenerator.php b/src/Generator/TypeGenerator.php index 0d7fc532..ee77d324 100644 --- a/src/Generator/TypeGenerator.php +++ b/src/Generator/TypeGenerator.php @@ -69,7 +69,7 @@ public static function fromReflectionType( return new self( $atomicType, - $atomicType->type !== 'mixed' && $atomicType !== 'null' && $type->allowsNull() + $atomicType->type !== 'mixed' && $atomicType->type !== 'null' && $type->allowsNull() ); } From 7a837bb128f2fac0b9b5963abbee0ac6958cadbe Mon Sep 17 00:00:00 2001 From: George Steel Date: Fri, 25 Oct 2024 11:20:32 +0100 Subject: [PATCH 2/2] Reset baseline post merge-up Signed-off-by: George Steel --- psalm-baseline.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 3036a1db..43d9a082 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -591,10 +591,6 @@ $type - - - type !== 'mixed' && $atomicType !== 'null']]> - $type instanceof ReflectionNamedType