Re: constructor hook
| From: | Johannes Schlüter | Date: | Tue, 18 Sep 2012 13:07:13 +0000 |
| Subject: | Re: constructor hook | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63059@lists.php.net to get a copy of this message | ||
On Tue, 2012-09-18 at 08:19 -0400, Rasmus Schultz wrote:
> Hey,
>
> I'm going to make this brief, because I suspect a lot of people are going
> to jump at the opportunity to cry bloody murder when I suggest this.
>
> I wonder if it would make sense to have a way to globally hook into
> __construct() - sort of like how you can hook into the autoloaders with
> spl_autoload_register() ...
>
> This could be useful for things like dependency injection and debugging.
I don't think it's a good thing to have. "new" right now gives you a
clear idea whats going on. Magic behind the scenes is hard to debug.
If you really want it: https://github.com/johannes/php-test-helpers
johannes