Signature Compatibility Exception

<?php

// Normal constructor
abstract class x {
     function __construct($a) {}
}

class y extends x {
    // OK
    function __construct($b, $c) {}
}

// abstract constructor
abstract class x2 {
     abstract function __construct($a);
}

class y2 extends x2 {
    // KO
    function __construct($b, $c) {}
}

// With interface
interface i3 {
     abstract function __construct($a);
}

class y3 implements i3 {
    // KO
    function __construct($b, $c) {}
}

All methods must be compatible with their parent’s signature: the types, reference options, variadic and number must be compatible (although, not equal).

The exception are constructors, which may be completely different from their parent’s. This is for backward compatibility.

And this rule also has the exception that abstract constructor, in interfaces and abstract parent classes, must be compatible, and their signature are enforced. Normal constructor are free.

See Also

PHP Features

Last updated: 14 July 2026