88use TypeLang \PhpDocParser \DocBlock \Tag \GenericTag ;
99use TypeLang \PhpDocParser \DocBlock \Tag \InvalidTag ;
1010use TypeLang \PhpDocParser \DocBlock \Tag \InvalidTypedTag ;
11+ use TypeLang \PhpDocParser \DocBlock \Tag \TagFactory ;
1112use TypeLang \PhpDocParser \DocBlock \Tag \TagInterface ;
1213use TypeLang \PhpDocParser \Exception \InvalidTagVariableNameException ;
1314
1415/**
15- * @template-implements TagFactoryInterface <TagInterface>
16+ * @template-extends TagFactory <TagInterface>
1617 */
17- final class StandardTagFactory implements TagFactoryInterface
18+ final class StandardTagFactory extends TagFactory
1819{
1920 private readonly TagNameExtractor $ parts ;
2021
@@ -48,6 +49,8 @@ public function __construct(
4849 foreach ($ factories as $ name => $ factory ) {
4950 $ this ->add ($ factory , $ name );
5051 }
52+
53+ parent ::__construct ();
5154 }
5255
5356 /**
@@ -84,17 +87,15 @@ public function create(string $tag): TagInterface
8487 return $ factory ->create ($ body );
8588 } catch (InvalidTagVariableNameException $ e ) {
8689 $ type = $ e ->getType ();
87- $ body = Description::fromNonTagged (
88- body: \substr ($ body , $ e ->getTypeOffset ()),
89- );
90+ $ body = $ this ->createDescription (\substr ($ body , $ e ->getTypeOffset ()));
9091
9192 if ($ type === null ) {
9293 return new InvalidTag ($ name , $ body );
9394 }
9495
9596 return new InvalidTypedTag ($ name , $ type , $ body );
9697 } catch (\InvalidArgumentException ) {
97- return new InvalidTag ($ name , Description:: fromNonTagged ($ body ));
98+ return new InvalidTag ($ name , $ this -> createDescription ($ body ));
9899 }
99100 }
100101
@@ -104,7 +105,7 @@ public function create(string $tag): TagInterface
104105 return new GenericTag ($ name );
105106 }
106107
107- return new GenericTag ($ name , Description:: fromNonTagged ($ body ));
108+ return new GenericTag ($ name , $ this -> createDescription ($ body ));
108109 }
109110
110111 private function getFactory (string $ tag ): ?TagFactoryInterface
0 commit comments