Ciao a tutti, volevo sapere come posso fare per realizzare una cosa del genere:
In questo caso ho un errore del tipo:Codice PHP:
//Tipi degli oggetti
class SuperType {}
class Type extends SuperType {}
class Foo {
public function test(SuperType $t) {
echo get_class($t);
}
}
class Bar {
public function test(Type $t) {
echo get_class($t);
}
}
Cioè vorrei fare una specie di overloading sul metodo test che in php non è previsto, quindi nel metodo Bar::test() devo usare per forza SuperType come tipo o ci sono altre soluzioni?Fatal error: Declaration of Bar::test() must be compatible with that of Foo::test()