Anthony,
I like it. The one thing that is lacking in the PHP ecosystem is some kind of support for a "Gentleman's Agreement" when it comes to APIs. I am very much opposed to central bodies of code and/or shared interfaces (like the PSR-3's et. al.) for seemingly simple and cross-cutting APIs.
An idea I had been kicking around, if yours in full does not pass the muster, was adding a function to do something similar (also requires changes to the instanceof checks in the engine):
register_compatible_types($yourType, $myType);
which basically would allow any of $myTypes (My\LoggerInterface) to pass when the engine is testing for instanceof $yourType.
I do hope we get something like either of these solutions for PHP.next.
-ralph
On 6/25/13 10:57 AM, Anthony Ferrara wrote:
Hey all,
I want to throw out this draft RFC to get the concept floating around and
get feedback early.
https://wiki.php.net/rfc/protocol_type_hinting
There are still open questions, and a more complete (and cleaner)
implementation will be needed before officially proposing it, but I wanted
to get the concept out as soon as possible.
What do you think?
Thanks!
Anthony