Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
also add up the overhead of throwing an exception, or trigger_error() to match the full functionality of type hinting and you have a nice tidy gain to using it over not using it
If it talks and acts like a duck, it's a duck. Object hierarchies be darned.
(This means that I don't use type hinting not because of performance issues but because it gives me less flexibility in what I can pass a function. What if the object's decorated or something?)
it gives me less flexibility in what I can pass a function
Well yes, that is a good reason not to use type hinting. I specifically like it because I don't trust myself with flexibility. I like to limit my inputs and outputs to the smallest possible range to get the job done; and I wouldn't say I'm alone.
Most microtime benchmarks are insignificant to actual application stress tests where a great deal of improvement can be gain by finding the bottle necks using a tracer tool, and in most cases, the bottle necks are the database and disk IO.
I think more time may be wiser spent on application design and testing (of all forms) than worrying about the impact of using hinting or otherwise in terms of performance.
Type hinting would screw with a proxy too if the proxy worked by using the overloaded magic methods.... hmm... then again so would using an interface in this instance.
I think more time may be wiser spent on application design and testing (of all forms) than worrying about the impact of using hinting or otherwise in terms of performance.