Has there ever been any discussion on an __init magic method for
bootstraping static properties on class load?
The usual solution I come up with is manually calling an init method post
class definition, which works, though I'd call it slighly less than elegant:
class Foo {
static $bar;
static function init () {
// Create $bar with expressions...
self::$bar = $bar;
}
}
Foo:init();
A custom autoloader could of course anticipate this but with systems like
composer that have a shared autoload, it'd be nicer to use those than rely
on a custom loader.
--
Pete Boere
Web Developer