Always Compatible Variadic

By Sergii Shymko

<?php

interface i {
    function foo($a, $b = 2);
}

class x implements i {
    // This is compatible with the interface definition
    function foo(...$args) {}
}

?>

A variadic argument is a valid and compatible signature, for methods that overwrite other methods.

Method compatibility usually require the arguments to be the same, but with a variadic argument and also some of the arguments from the parent method, the signature is still considered compatible by PHP.

See Also

PHP Features

Last updated: 14 July 2026