Zeev Suraski wrote:

If you take into account that [a] in PHP, you cannot have more than one signature for a method in a given class, and you take into account the fact that [b] your overriding method must be able to satisfy the same interface as the method its overriding

The real solution is not to assume that the inheritance contract is in place, but to make it explicit. Final is used to prevent inheritance altogether, why not use the implements keyword as an explicit inheritance contract, and otherwise assume there is none. This preserves BC 100%


No need to futz with php.ini, this would be a mistake.

<?php
class first {
    function method($a)
    {
    }
}

class second extends first {
    function method() // this is fine
    {
         parent::method('something');
    }
}

class third implements someinterface {
    function method($a)
    {
    }
}

class fourth extends third {
    function method() // compile error
    {
         parent::method('something');
    }
}
?>

Greg

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to