Compatibility

Compatibility refers to the ability of two or more things to work together without conflicts or issues.

In PHP context, it may refer to

  • version compatibility, when code works in both versions

  • system compatibility, when code works on different operating systems

  • method compatibility, when methods are compatible in the parent and the child class.

<?php

class X {
    function foo(int $i) {}
}

class Y extends X {
    // The type must be compatible with the one of the parent
    // The name does not have to be the same as in the parent
    function foo(int|null $b) {}
}

?>

Related : Method Compatibility, Interoperability, Migration