Run Rector on your code to see what it can do for you:

 interface Foo {}
 interface Bar {}
 
-function name(Foo&Bar $foo = null): string {
+function name((Foo&Bar)|null $foo = null): string {
     return (string) $foo;
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: 007114 - released at 2026-03-12 18:24