Greg Korba ๐Ÿ› ๏ธ๐Ÿ›น Codito @codito.dev ยท Dec 6

"Closures in constant expressions" #PHP RFC was accepted and implemented, so in the next non-patch version (8.5 / 9.0) it will be possible to assign closures as a default values for class properties or function arguments. WDYT ๐Ÿค”? wiki.php.net/rfc/closures... 3v4l.org/8bLVZ/rfc#vg...

3 likes 1 replies

?

Replies

Greg Korba ๐Ÿ› ๏ธ๐Ÿ›น Codito ยท Dec 6

Interestingly, properties with closures assigned as default value can also have property hooks, which makes the syntax a bit too curly ๐Ÿ™ˆ. Imagine default closure with actual body + hooks...... oof, let's pray for #PHPCSFixer ๐Ÿ™๐Ÿ˜†.