1--TEST-- 2AST printing for closures in attributes 3--FILE-- 4<?php 5 6// Do not use `false &&` to fully evaluate the function / class definition. 7 8try { 9 \assert( 10 ! 11 #[Attr(static function ($foo) { 12 echo $foo; 13 })] 14 function () { } 15 ); 16} catch (Error $e) { 17 echo $e->getMessage(), "\n"; 18} 19 20try { 21 \assert( 22 ! 23 new #[Attr(static function ($foo) { 24 echo $foo; 25 })] 26 class {} 27 ); 28} catch (Error $e) { 29 echo $e->getMessage(), "\n"; 30} 31 32?> 33--EXPECT-- 34assert(!#[Attr(static function ($foo) { 35 echo $foo; 36})] function () { 37}) 38assert(!new #[Attr(static function ($foo) { 39 echo $foo; 40})] class { 41}) 42