Re: ReflectionClass::newInstanceWithoutConstructor()
| From: | Richard Quadling | Date: | Thu, 25 Aug 2011 12:26:12 +0000 |
| Subject: | Re: ReflectionClass::newInstanceWithoutConstructor() | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-54930@lists.php.net to get a copy of this message | ||
On 25 August 2011 10:46, Sebastian Bergmann <sebastian@php.net> wrote:
> I have attached a patch to
> https://bugs.php.net/bug.php?id=55490 that
> implements ReflectionClass::newInstanceWithoutConstructor() to create an
> object a class without invoking the constructor.
>
> As there are certain internal classes that would "crash" when their
> constructor is not invoked, this new method of the Reflection API only
> works for userland-defined classes.
>
> Unless there are objections, I will commit this change to PHP_5_4 and
> trunk on Monday. I will add the method to the documentation as well, of
> course.
Wouldn't ReflectionClass::newMockInstance() be a better name?
What other use cases exists?
--
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea