note 123784 added to class.reflectionexception
| From: | temirkhan.nasukhov@php.net | Date: | Thu, 18 Apr 2019 11:50:39 +0000 |
| Subject: | note 123784 added to class.reflectionexception | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210619@lists.php.net to get a copy of this message | ||
Note that this exception is unchecked even if it is not based on RuntimeException. Such error must
lead to direct fixes in code and not in catch-handle of situation.
Also keep in mind that IDE (mine is Phpstorm 2018.3.4) inspections will highlight it for that reason
so do not create phpdoc with throws for any Runtime exceptions.
<?php
/**
* This way is wrong
*
* @throws \ReflectionException
*/
function createReflection()
{
return new \ReflectionClass('invalid argument');
}
/**
* This way is fine(I don't mean the code of course)
*/
function createReflection()
{
return new \ReflectionClass('invalid argument');
}
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.142 (proxied: 185.89.15.66)
----
Manual Page -- http://php.net/manual/en/class.reflectionexception.php
Edit -- https://master.php.net/note/edit/123784
Del: integrated -- https://master.php.net/note/delete/123784/integrated
Del: useless -- https://master.php.net/note/delete/123784/useless
Del: bad code -- https://master.php.net/note/delete/123784/bad+code
Del: spam -- https://master.php.net/note/delete/123784/spam
Del: non-english -- https://master.php.net/note/delete/123784/non-english
Del: in docs -- https://master.php.net/note/delete/123784/in+docs
Del: other reasons-- https://master.php.net/note/delete/123784
Reject -- https://master.php.net/note/reject/123784
Search -- https://master.php.net/manage/user-notes.php