File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
src/Symfony/Component/VarExporter Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ public static function exportType(\ReflectionFunctionAbstract|\ReflectionPropert
311
311
return '' ;
312
312
}
313
313
if (null === $ glue ) {
314
- return (!$ noBuiltin && $ type ->allowsNull () && 'mixed ' !== $ name ? '? ' : '' ).$ types [0 ];
314
+ return (!$ noBuiltin && $ type ->allowsNull () && $ type -> getName () !== ' null ' && 'mixed ' !== $ name ? '? ' : '' ).$ types [0 ];
315
315
}
316
316
sort ($ types );
317
317
Original file line number Diff line number Diff line change @@ -188,6 +188,24 @@ public function testCannotGenerateGhostForStringMagicGet()
188
188
$ this ->expectException (LogicException::class);
189
189
ProxyHelper::generateLazyGhost (new \ReflectionClass (StringMagicGetClass::class));
190
190
}
191
+
192
+ /**
193
+ * @requires PHP 8.2
194
+ */
195
+ public function testNullStandaloneReturnType ()
196
+ {
197
+ $ classWithNullReturnType = new class {
198
+ public function foo (): null
199
+ {
200
+ return null ;
201
+ }
202
+ };
203
+
204
+ self ::assertStringContainsString (
205
+ 'public function foo(): null ' ,
206
+ ProxyHelper::generateLazyProxy (new \ReflectionClass ($ classWithNullReturnType ))
207
+ );
208
+ }
191
209
}
192
210
193
211
abstract class TestForProxyHelper
You can’t perform that action at this time.
0 commit comments