Re: Re: [Zend Engine 2] Type hints revisited [IllegalArgumentException instead of E_ERROR]
| From: | Shane Caraveo | Date: | Thu, 27 Mar 2003 18:27:17 +0000 |
| Subject: | Re: Re: [Zend Engine 2] Type hints revisited [IllegalArgumentException instead of E_ERROR] | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-392@lists.php.net to get a copy of this message | ||
Andi Gutmans wrote:
At 09:42 AM 3/27/2003 -0800, Shane Caraveo wrote:Well, if set_error_handler could catch E_ERROR errors (and not bail), then errors could be changed to exceptions in user space. I already use this in the soap library to catch invalid parameters, which I beleive are only warnings. Not being able to catch exceptions on type hints will make them pretty useless to me.Now that is a very strong statement. I consider type hints useful syntactic sugar but I don't think that it's useless if it doesn't throw an exception.
AndiStrong to make the point, and not only useless to me, but to anyone using OO with SOAP. It prevents a proper SOAPFault from being returned by the server. There is no reason for this to be E_ERROR, we're not a compiled language. And I'm not arguing for hints to thow exceptions, just for them to be 'catchable' via the regular error handlers, rather than bailing PHP.
If soap is a special case because of its nature, then don't use type hints and check their type and throw an exception in user-land.Doing stuff in userland is fine, but type hints would simplify code and remove the need to do that in user land. Of course, so would operator overloading. Shane