Hi!

> Too many times have I seen developers throwing Exceptions when what they
> really needed was something that gave it context like
> InvalidArgumentException or RuntimeException. Yes, I agree this is
> something to tackle at code review (and I do) but I feel PHP doesn't help
> the situation by making it an instantiatable class. I struggle to think of

Indeed, it doesn't - but PHP doesn't have to be helpful for 100% of
every use cases. It is plain impossible as some of them are in direct
contradiction. Example - one use case is yours, maintaining a code
standard in a project with strict guidelines. Another - making a
langugage that is easy to use to most unsophisticated user for quick
prototyping. Where concerns about strict exception hierarchy may be well
below concerns of developer convenience and productivity.
Thus, in one case you may not want to use Exception and in another
Exception may be all you need. The conflict can be resolved very easily
- leave Exception as is and introduce a policy using one of the
multitude of great code style tools available for the complex project.
IMO it's much better than creating a huge BC break that excludes one of
the use cases.
-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to