From 156b60ff556529e3f916a2e0d4dacba394d256c8 Mon Sep 17 00:00:00 2001 From: Robert Lemke Date: Wed, 7 Jun 2023 12:52:47 +0200 Subject: [PATCH] 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() ); }