I can override a PHP method in a child class and change the parameters in the signature, as shown below.
class theParent {
function myMethod($param1) {
// code here
}
}
class theChild extends theParent {
function myMethod($param1, $param2) {
// code here
}
}
I tested this and it works fine and does not raise any errors. My question is, is this bad form? Or a basic tenet of OOP?
If the parent method is declared abstract the child signatures can not deviate. Presumably this is the mechanism to use if you need to enforce that aspect of the interface?