88use TypeLang \Parser \Parser as TypesParser ;
99use TypeLang \Parser \ParserInterface as TypesParserInterface ;
1010use TypeLang \PHPDoc \DocBlock \Tag \Factory \TagFactoryInterface ;
11- use TypeLang \PHPDoc \Parser \Content \OptionalTypeParserReader ;
11+ use TypeLang \PHPDoc \Parser \Content \OptionalTypeReader ;
1212use TypeLang \PHPDoc \Parser \Content \OptionalValueReader ;
1313use TypeLang \PHPDoc \Parser \Content \Stream ;
1414use TypeLang \PHPDoc \Parser \Content \TypeParserReader ;
@@ -27,11 +27,11 @@ public function __construct(
2727
2828 public function create (string $ tag , string $ content , DescriptionParserInterface $ descriptions ): MethodTag
2929 {
30- $ stream = new Stream ($ content );
30+ $ stream = new Stream ($ tag , $ content );
3131
3232 $ isStatic = $ stream ->apply (new OptionalValueReader ('static ' )) !== null ;
33- $ returnType = $ stream ->apply (new TypeParserReader ($ tag , $ this ->parser ));
34- $ callableType = $ stream ->apply (new OptionalTypeParserReader ($ this ->parser ));
33+ $ returnType = $ stream ->apply (new TypeParserReader ($ this ->parser ));
34+ $ callableType = $ stream ->apply (new OptionalTypeReader ($ this ->parser ));
3535
3636 // In case of return type has not been defined then we swap first
3737 // defined type as method signature definition.
@@ -63,9 +63,7 @@ public function create(string $tag, string $content, DescriptionParserInterface
6363 name: $ tag ,
6464 type: $ callableType ,
6565 static: $ isStatic ,
66- description: \trim ($ stream ->value ) !== ''
67- ? $ descriptions ->parse (\rtrim ($ stream ->value ))
68- : null ,
66+ description: $ stream ->toOptionalDescription ($ descriptions ),
6967 );
7068 }
7169}
0 commit comments