<?php class Bar {} class Baz {} function foo(array $bars) { $bars = (fn (Bar ...$bars) => $bars)(...$bars); var_dump($bars); } foo([new Bar, new Bar]); foo([new Bar, new Baz]);
You have javascript disabled. You will not be able to edit any code.