We have some legacy interface code that i want to extend without breaking other classes that implements it. I need to add additional parameter to one of the interface methods so new classes that will implement the interface will use and old one will ignore it. AFAIK, there is not way to change the interface without changing the implementing method signature.
Current implementation:
interface inter
{
public function hey($rr);
}
class Cl implements inter
{
function hey($rr) {
echo "hey";
}
}
I would like something like this:
interface inter
{
public function hey($rr, $ee = true);
}
class Cl implements inter
{
function hey($rr) {
echo "hey";
}
}
i know this will cause fatal error - i wish to understand if there is some similar way or maybe best practice for this scenario.
Thanks, Alon
Aucun commentaire:
Enregistrer un commentaire