2222use Symfony \Component \VarExporter \Tests \Fixtures \FooSerializable ;
2323use Symfony \Component \VarExporter \Tests \Fixtures \FooUnitEnum ;
2424use Symfony \Component \VarExporter \Tests \Fixtures \MySerializable ;
25+ use Symfony \Component \VarExporter \Tests \Fixtures \PrivateFCC ;
2526use Symfony \Component \VarExporter \VarExporter ;
2627
2728class VarExporterTest extends TestCase
@@ -80,7 +81,7 @@ public static function provideFailingSerialization()
8081 public function testExport (string $ testName , $ value , bool $ staticValueExpected = false )
8182 {
8283 $ dumpedValue = $ this ->getDump ($ value );
83- $ isStaticValue = true ;
84+ $ isStaticValue = null ;
8485 $ marshalledValue = VarExporter::export ($ value , $ isStaticValue );
8586
8687 $ this ->assertSame ($ staticValueExpected , $ isStaticValue );
@@ -99,7 +100,7 @@ public function testExport(string $testName, $value, bool $staticValueExpected =
99100 }
100101 $ marshalledValue = include $ fixtureFile ;
101102
102- if (!$ isStaticValue ) {
103+ if (!$ isStaticValue || ' named-closure-static ' === $ testName || ' private-fcc ' === $ testName ) {
103104 if ($ value instanceof MyWakeup) {
104105 $ value ->bis = null ;
105106 }
@@ -234,11 +235,20 @@ public static function provideExport()
234235 yield ['unit-enum ' , [FooUnitEnum::Bar], true ];
235236 yield ['readonly ' , new FooReadonly ('k ' , 'v ' )];
236237
238+ yield ['named-closure-method ' , (new TestClass ())->testMethod (...)];
239+ yield ['named-closure-static ' , TestClass::testStaticMethod (...), true ];
240+
237241 if (\PHP_VERSION_ID < 80400 ) {
238242 return ;
239243 }
240244
241245 yield ['backed-property ' , new BackedProperty ('name ' )];
246+
247+ if (\PHP_VERSION_ID < 80500 ) {
248+ return ;
249+ }
250+
251+ yield ['private-fcc ' , (new \ReflectionClass (PrivateFCC::class))->getAttributes (PrivateFCC::class)[0 ]->getArguments ()[0 ], true ];
242252 }
243253
244254 public function testUnicodeDirectionality ()
@@ -299,6 +309,19 @@ private function __construct($prop)
299309 }
300310}
301311
312+ class TestClass
313+ {
314+ public function testMethod ()
315+ {
316+ return 'test ' ;
317+ }
318+
319+ public static function testStaticMethod ()
320+ {
321+ return 'test ' ;
322+ }
323+ }
324+
302325class MyPrivateValue
303326{
304327 protected $ prot ;
0 commit comments