diff --git a/Tests/BackCompat/BCFile/FindExtendedClassNameTest.inc b/Tests/BackCompat/BCFile/FindExtendedClassNameTest.inc index d8bb1b58..d4669254 100644 --- a/Tests/BackCompat/BCFile/FindExtendedClassNameTest.inc +++ b/Tests/BackCompat/BCFile/FindExtendedClassNameTest.inc @@ -47,6 +47,12 @@ class testFECNClassThatImplementsAndExtends implements InterfaceA, InterfaceB ex /* testInterfaceMultiExtends */ interface Multi extends \Package\FooInterface, \BarInterface {}; +/* testExtendedReadonlyAnonClass */ +$anon = new readonly class() extends \Fully\Qualified\MyClass {}; + +/* testExtendedAnonClassWithAttributes */ +$anon = new #[SomeAttribute] class( $p ) extends Partially\Qualified\MyClass {}; + /* testMissingExtendsName */ class testMissingExtendsName extends { /* missing classname */ } // Intentional parse error. diff --git a/Tests/BackCompat/BCFile/FindExtendedClassNameTest.php b/Tests/BackCompat/BCFile/FindExtendedClassNameTest.php index 2adc29cf..293681cf 100644 --- a/Tests/BackCompat/BCFile/FindExtendedClassNameTest.php +++ b/Tests/BackCompat/BCFile/FindExtendedClassNameTest.php @@ -161,6 +161,14 @@ public static function dataExtendedClass() 'identifier' => '/* testInterfaceMultiExtends */', 'expected' => '\Package\FooInterface', ], + 'readonly anon class extends fully qualified class' => [ + 'identifier' => '/* testExtendedReadonlyAnonClass */', + 'expected' => '\Fully\Qualified\MyClass', + ], + 'anon class with attribute extends partially qualified class' => [ + 'identifier' => '/* testExtendedAnonClassWithAttributes */', + 'expected' => 'Partially\Qualified\MyClass', + ], 'parse error - extends keyword, but no class name' => [ 'identifier' => '/* testMissingExtendsName */', 'expected' => false,