note 117332 added to reflectionclass.construct
| From: | danbettlesatyahoodotcodotuk | Date: | Fri, 22 May 2015 18:47:46 +0000 |
| Subject: | note 117332 added to reflectionclass.construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202643@lists.php.net to get a copy of this message | ||
To reflect on a namespaced class in PHP 5.3, you must always specify the fully qualified name of the
class - even if you've aliased the containing namespace using a "use" statement.
So instead of:
<?php
use App\Core as Core;
$oReflectionClass = new ReflectionClass('Core\Singleton');
?>
You would type:
<?php
use App\Core as Core;
$oReflectionClass = new ReflectionClass('App\Core\Singleton');
?>
----
Server IP: 216.194.115.244
Probable Submitter: 70.121.55.125
----
Manual Page -- http://php.net/manual/en/reflectionclass.construct.php
Edit -- https://master.php.net/note/edit/117332
Del: integrated -- https://master.php.net/note/delete/117332/integrated
Del: useless -- https://master.php.net/note/delete/117332/useless
Del: bad code -- https://master.php.net/note/delete/117332/bad+code
Del: spam -- https://master.php.net/note/delete/117332/spam
Del: non-english -- https://master.php.net/note/delete/117332/non-english
Del: in docs -- https://master.php.net/note/delete/117332/in+docs
Del: other reasons-- https://master.php.net/note/delete/117332
Reject -- https://master.php.net/note/reject/117332
Search -- https://master.php.net/manage/user-notes.php