I am interested if its possible with any trickery, and or cool PHP features to have a child class inherit from a parent and have the same name as a parent. This should be able to be repeated as many times as desired.
This can be done in a number of ways I figure, but I am interested to see what the community turns up.
I am interested to also hear if people think this is useful or if standard inheritance is just as acceptable.
Really the power that I see in it, (assuming the base object is built correctly). is amazingly long term extend ability and maintainability, while being super pro and also not making your average bear confused to all living heck.
Lets pretend we have some active record base types.
Class Active Record => Contacts
I want to Override Contacts with MyContacts but would rather see everywhere in the system currently using Contacts to not have to be changed in anyway whatsoever... and Instead be branded as Contacts.
Active Record -> Contacts -> MyContacts (Contact).
Theoretically as above stated it should be possible to do.
Active Record -> Contacts -> MyContacts (Contact ) -> YourContacts (Contact).
Anywhere Contacts is referenced should still not give any Undefined class, or not give the child's most functionality whenever present.
How could this be achieved without doing something like...
$class_name = ClassFactory::instance("Contact");
$class = new $class_name($args);
What we are looking for: $class = new Contacts();
Where $class could be the newest version of Contacts
Active Record => Contacts
Active Record => Contacts -> MyContacts (Contact)
Active Record => Contacts -> MyContacts (Contact) -> YourContacts (Contact).
In the case of
$class->undefinedFun();
Accepted that -> Absolute base class, or __call function of any of the teirs of the class would define if it is an error or not.