> Throwing `\InvalidArgumentException` is
> another widely used alternative, however, that would be a change in the
> specification (as Calling Libraries would then need to know to catch that
> exception as well).

Let me disagree. Why Calling Libraries have to know about it? Why Calling 
Libraries don't have to know about AssertionError exception then?

PHP is annoying in this part: it doesn't distinguish between checked and 
unchecked exceptions at language level
like Java does.
However, it doesn't mean that we have to treat all exceptions as checked 
ones.
Who said that \InvalidArgumentException or, let's say, \LogicException must 
be documented?

These exceptions are very close to runtime exceptions in 
Java: https://docs.oracle.com/javase/7/docs/api/java/lang/RuntimeException.html
And runtime exceptions include, for example, IllegalArgumentException.
These exceptions notify about errors, this is not public contract of an 
interface. 
You usually don't need to catch them directly. They just should be fixed at 
the code level. Or infrastructure level.

(Moreover, in my opinion, \LogicException is something that close to 
compile errors in Java, not even runtime exceptions, because it includes 
http://php.net/manual/en/class.badmethodcallexception.php).

On Tuesday, July 26, 2016 at 10:46:53 PM UTC+3, Larry Garfield wrote:
>
> Hi folks.  Based an a recent discussion with someone writing a PSR-6 
> implementation, I would like to offer the following errata for PSR-6: 
>
> https://github.com/php-fig/fig-standards/pull/787 
>
> I think the text of it is rather self-explanatory, and I link to the 
> original GitHub discussion that spawned the question. 
>
> Comments/feedback/etc. welcome.  As it's a non-trivial change (although 
> not API changing) it would probably need a vote, but likely an 
> uncontroversial one. 
>
> --Larry Garfield 
>

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/8a897f5c-41b1-436e-95ed-38397cfccead%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to