On Mon, Apr 13, 2015 at 7:37 AM, Johannes Ott <m...@deroetzi.de> wrote:
> Hi,
>
> finally I managed to do my first RFC draft.
>
> https://wiki.php.net/rfc/static_class_constructor
>
> I hope I have done everything correct so far and I'm looking forward to
> your feedback on it.

The static constructor cannot be called by the user, which means it
shouldn't even register as a function. Additionally, it is always
private. Given these constraints I would prefer to change this syntax:

class Config {

    private static $arIni;

    private static function __static() {
        $self::$arIni = parse_ini_file('config.ini');
    }
}

To this (borrowed from Java):

class Config {

    private static $arIni;

    static {
        $self::$arIni = parse_ini_file('config.ini');
    }
}

I do not see any reason to do the former unless the latter has
conflicts in the parser, which I don't think it would.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to