[php-src] Issue #8421: Attributes that target functions are not valid for anonymous functions defined within a method

From: Date: Thu, 21 Apr 2022 19:29:17 +0000
Subject: [php-src] Issue #8421: Attributes that target functions are not valid for anonymous functions defined within a method
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241140@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8421 Comment Author: ollieread > A closure is not a procedural function, a closure is actually a object of the > \Closure class with the method body being the code executed inside > the __invoke() magic method for which the closure syntax is sugar > for really. > > I doubt closures will be supported by attributes anytime soon as it will require copying > attributes to the object and you would then only be able to fetch it via > ReflectionObject as there isn't really another reliable way to > accomplish this. But closures do support attributes. The type of target they require depends entirely on whether or not they have a scope, which feels like a definite bug.

« previous php.bugs (#241140) next »