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: 0594c1 - released at 2026-05-08 19:57