On 15 May 2015 at 14:38, Xinchen Hui <larue...@gmail.com> wrote: > I'd prefer to > disallow initializing a engine exception from user land.. > like if you try to initialize a engine/type/parser exception, an E_ERROR > of: > what do you think?
Someone reminded me that TypeExceptions are almost certainly going to be re-used by users for the cases where PHP's type system isn't powerful enough to handle their use cases: function handleFooOrBar($instance) { if(!$instance instanceof Bar && !$lol instanceof Foo) { throw new TypeException('$instance must be either an instance of Bar or Foo'); } ... } Re-using the built-in TypeException for this would be the right thing to do and so it needs to be creatable in userland. cheers Dan -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php