Hi

On 11/27/24 22:50, Juliette Reinders Folmer wrote:
One thing I'm wondering about - and of which I saw no mention in the RFC
nor in the preceding discussion - knowing that function names are
case-insensitive, how is ambiguity handled when _calling_ a callback
stored in a (class) constant ?

Nothing changed about the grammar or the way a PHP program is parsed into Opcodes. As mentioned in the RFC it does not include any backwards incompatible changes, except for making some illegal PHP programs legal.

In fact you are already able to store Closures in dynamic constants defined with the `define()` function (https://3v4l.org/u7ZJ1).

In any case that means that all your examples are interpreted as function calls. You need parentheses around the constant name to "dereference" the value stored in the constant. This is consistent with $obj->foo() always being a method call to the foo() method, not a call to a Closure stored in a property called $foo.

Best regards
Tim Düsterhus

Reply via email to