[ 'code' => ' */ abstract class BaseRepository {} class StudentViewData implements IBaseViewData {} class TeacherViewData implements IBaseViewData {} /** @extends BaseModel */ class StudentModel extends BaseModel {} /** @extends BaseModel */ class TeacherModel extends BaseModel {} /** @extends BaseRepository */ class StudentRepository extends BaseRepository {} /** @extends BaseRepository */ class TeacherRepository extends BaseRepository {}' ], 'unwrapIndirectGenericTemplated' => [ 'code' => ' * @param TWrapper2 $wrapper * @return TInner2 */ function indirectUnwrap(Wrapper $wrapper) : object { return unwrapGeneric($wrapper); } /** * @template TInner1 * @template TWrapper1 of Wrapper * @param TWrapper1 $wrapper * @return TInner1 */ function unwrapGeneric(Wrapper $wrapper) { return $wrapper->unwrap(); }' ], 'unwrapFromTemplatedClassString' => [ 'code' => ' */ class StringWrapper implements Wrapper { public function unwrap() { return "hello"; } } /** * @template TInner * @template TWrapper of Wrapper * * @param class-string $class * @return TInner */ function load(string $class) { $package = new $class(); return $package->unwrap(); } $result = load(StringWrapper::class);' ], 'unwrapNestedTemplateWithReset' => [ 'code' => ' * @param TArray $arr * @return TValue */ function toList(array $arr): array { return reset($arr); }' ], ]; } public function providerInvalidCodeParse(): iterable { return [ 'nestedTemplateExtendsInvalid' => [ 'code' => ' */ abstract class BaseRepository {} class StudentViewData implements IBaseViewData {} class TeacherViewData implements IBaseViewData {} /** @extends BaseModel */ class StudentModel extends BaseModel {} /** @extends BaseModel */ class TeacherModel extends BaseModel {} /** @extends BaseRepository */ class StudentRepository extends BaseRepository {}', 'error_message' => 'InvalidTemplateParam' ], ]; } }