55namespace phpDocumentor \Reflection \DocBlock \Tags \Factory ;
66
77use Webmozart \Assert \Assert ;
8+ use phpDocumentor \Reflection \DocBlock \Tag ;
89use phpDocumentor \Reflection \TypeResolver ;
910use phpDocumentor \Reflection \Types \Context ;
10- use phpDocumentor \ Reflection \ DocBlock \ Tag ;
11+ use PHPStan \ PhpDocParser \ Ast \ PhpDoc \ PhpDocTagNode ;
1112use phpDocumentor \Reflection \DocBlock \Tags \Implements_ ;
1213use phpDocumentor \Reflection \DocBlock \DescriptionFactory ;
13- use PHPStan \PhpDocParser \Ast \PhpDoc \PhpDocTagNode ;
1414use PHPStan \PhpDocParser \Ast \PhpDoc \ImplementsTagValueNode ;
15+ use phpDocumentor \Reflection \DocBlock \Tags \TemplateImplements ;
1516
1617/**
1718 * @internal This class is not part of the BC promise of this library.
@@ -32,14 +33,21 @@ public function create(PhpDocTagNode $node, Context $context): Tag
3233 $ tagValue = $ node ->value ;
3334 Assert::isInstanceOf ($ tagValue , ImplementsTagValueNode::class);
3435
35- return new Implements_ (
36+ $ description = $ tagValue ->getAttribute ('description ' );
37+ if (is_string ($ description ) === false ) {
38+ $ description = $ tagValue ->description ;
39+ }
40+
41+ $ class = $ node ->name === '@implements ' ? Implements_::class : TemplateImplements::class;
42+
43+ return new $ class (
3644 $ this ->typeResolver ->createType ($ tagValue ->type , $ context ),
3745 $ this ->descriptionFactory ->create ($ tagValue ->description , $ context )
3846 );
3947 }
4048
4149 public function supports (PhpDocTagNode $ node , Context $ context ): bool
4250 {
43- return $ node ->value instanceof ImplementsTagValueNode && $ node ->name === '@implements ' ;
51+ return $ node ->value instanceof ImplementsTagValueNode && ( $ node ->name === '@implements ' || $ node -> name === ' @template-implements ' ) ;
4452 }
4553}
0 commit comments