A quick consensus on magic method idea
| From: | Chris Stockton | Date: | Fri, 04 Feb 2011 04:30:38 +0000 |
| Subject: | A quick consensus on magic method idea | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-51425@lists.php.net to get a copy of this message | ||
Hello,
I haven't seen a magic method proposed in a while so I am not sure how
people feel about them, obviously adding them can break BC (although
it is recommended people should not use __). I'm sure a good amount of
use/desire needs to be shown for inclusion. Here is what I decided I
would like to have and just implemented:
Loader.php:
--
class Loader {
static public function __compiled() {
echo "I was ran at the end of zend_do_end_class_declaration";
}
}
Run script:
<?php
include "Loader.php";
Prints:
I was ran at the end of zend_do_end_class_declaration
At first thought I figured this would be pretty simple to implement,
which it is.. for a basic use case. It seems I will need a bit more
work to handle issues when you do certain things inside __compiled. If
anyone has any interest I would fix it and make a clean patch, so
would anyone find this useful?
-Chris