Re: Inconsistencies in callable, call_user_func and direct variable calls

From: Date: Tue, 20 Jan 2015 22:02:31 +0000
Subject: Re: Inconsistencies in callable, call_user_func and direct variable calls
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-80908@lists.php.net to get a copy of this message
On 20.01.2015 22:46, Nikita Popov wrote:
On Tue, Jan 20, 2015 at 9:54 PM, Marc Bennewitz <dev@mabe.berlin <mailto:dev@mabe.berlin>> wrote:
    valid for call_user_func[_array] and callable type-hint but invalid
    for for direct variable calls:
    - string "MyClass::staticFunc"
    - string "self::staticFunc"
    - string "static::staticFunc"
    - string "parent::func"
    - string "parent::staticFunc"
    see http://3v4l.org/1oSO3
    Thoughts ?
I would prefer deprecating this alternative notation instead of adding more support for it. The [$class, $method] form is the canonical form we support everywhere and which is consistent with the [$obj, $method] callbacks. There's no point supporting another alternative notation, especially if it was effectively unusable for a while now already.
I don't think removing this is an option because of a big BC for no reason. Additionally the string alternative have some advantages: - better usable in configurations - return syntax of third argument of is_callable - ...
Nikita
Marc

« previous php.internals (#80908) next »