44
55namespace TypeLang \PHPDoc \Tag ;
66
7+ use TypeLang \Parser \Exception \ParserExceptionInterface ;
78use TypeLang \Parser \Node \Stmt \TypeStatement ;
89use TypeLang \Parser \ParserInterface as TypesParserInterface ;
910use TypeLang \PHPDoc \Exception \InvalidTagException ;
1011use TypeLang \PHPDoc \Parser \Description \DescriptionParserInterface ;
12+ use TypeLang \PHPDoc \Tag \Content \OptionalTypeParserApplicator ;
13+ use TypeLang \PHPDoc \Tag \Content \ValueApplicator ;
14+ use TypeLang \PHPDoc \Tag \Content \OptionalValueApplicator ;
1115use TypeLang \PHPDoc \Tag \Content \OptionalVariableNameApplicator ;
1216use TypeLang \PHPDoc \Tag \Content \TypeParserApplicator ;
1317use TypeLang \PHPDoc \Tag \Content \VariableNameApplicator ;
@@ -67,6 +71,14 @@ public function nextType(string $tag, TypesParserInterface $parser): TypeStateme
6771 return $ this ->apply (new TypeParserApplicator ($ tag , $ parser ));
6872 }
6973
74+ /**
75+ * @api
76+ */
77+ public function nextOptionalType (TypesParserInterface $ parser ): ?TypeStatement
78+ {
79+ return $ this ->apply (new OptionalTypeParserApplicator ($ parser ));
80+ }
81+
7082 /**
7183 * @api
7284 * @param non-empty-string $tag
@@ -86,6 +98,32 @@ public function nextOptionalVariable(): ?string
8698 return $ this ->apply (new OptionalVariableNameApplicator ());
8799 }
88100
101+ /**
102+ * @template T of non-empty-string
103+ *
104+ * @api
105+ * @param non-empty-string $tag
106+ * @param T $value
107+ * @return T
108+ */
109+ public function nextValue (string $ tag , string $ value ): string
110+ {
111+ return $ this ->apply (new ValueApplicator ($ tag , $ value ));
112+ }
113+
114+ /**
115+ * @template T of non-empty-string
116+ *
117+ * @api
118+ * @param non-empty-string $tag
119+ * @param T $value
120+ * @return T|null
121+ */
122+ public function nextOptionalValue (string $ value ): ?string
123+ {
124+ return $ this ->apply (new OptionalValueApplicator ($ value ));
125+ }
126+
89127 /**
90128 * @template T of mixed
91129 * @param callable(Content):T $applicator
0 commit comments