Based on your example it would be:
$animal->dog->haaa();
However, it might be best to change the design so that Dog extends Animal
:
class Dog extends Animal {
public function scream(){
// do stuff
}
}
$dog = new Dog();
$dog->scream();
That's more semantic, since dogs belong to the animal "kingdom".