File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed
unit/DocBlock/Tags/Factory Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 2121use phpDocumentor \Reflection \DocBlock \TagFactory ;
2222use phpDocumentor \Reflection \DocBlock \Tags \Factory \AbstractPHPStanFactory ;
2323use phpDocumentor \Reflection \DocBlock \Tags \Factory \Factory ;
24+ use phpDocumentor \Reflection \DocBlock \Tags \Factory \MethodFactory ;
2425use phpDocumentor \Reflection \DocBlock \Tags \Factory \ParamFactory ;
2526use phpDocumentor \Reflection \DocBlock \Tags \Factory \PropertyFactory ;
2627use phpDocumentor \Reflection \DocBlock \Tags \Factory \PropertyReadFactory ;
@@ -77,6 +78,7 @@ public static function createInstance(array $additionalTags = []): DocBlockFacto
7778 new PropertyFactory ($ typeResolver , $ descriptionFactory ),
7879 new PropertyReadFactory ($ typeResolver , $ descriptionFactory ),
7980 new PropertyWriteFactory ($ typeResolver , $ descriptionFactory ),
81+ new MethodFactory ($ typeResolver , $ descriptionFactory )
8082 );
8183
8284 $ tagFactory ->addService ($ descriptionFactory );
Original file line number Diff line number Diff line change 1717use phpDocumentor \Reflection \DocBlock \Description ;
1818use phpDocumentor \Reflection \DocBlock \StandardTagFactory ;
1919use phpDocumentor \Reflection \DocBlock \Tag ;
20+ use phpDocumentor \Reflection \DocBlock \Tags \Method ;
21+ use phpDocumentor \Reflection \DocBlock \Tags \MethodParameter ;
2022use phpDocumentor \Reflection \DocBlock \Tags \Param ;
2123use phpDocumentor \Reflection \DocBlock \Tags \See ;
2224use phpDocumentor \Reflection \Types \Array_ ;
2325use phpDocumentor \Reflection \Types \Integer ;
2426use phpDocumentor \Reflection \Types \String_ ;
27+ use phpDocumentor \Reflection \Types \Void_ ;
2528use PHPUnit \Framework \TestCase ;
2629
2730/**
@@ -185,4 +188,35 @@ public function testMultilineTags(): void
185188 );
186189
187190 }
191+
192+ public function testMethodRegression (): void
193+ {
194+ $ docCommment = <<<DOC
195+ /**
196+ * This is an example of a summary.
197+ *
198+ * @method void setInteger(integer \$integer)
199+ */
200+ DOC ;
201+ $ factory = DocBlockFactory::createInstance ();
202+ $ docblock = $ factory ->create ($ docCommment );
203+
204+ self ::assertEquals (
205+ [
206+ new Method (
207+ 'setInteger ' ,
208+ [],
209+ new Void_ (),
210+ false ,
211+ new Description ('' ),
212+ false ,
213+ [
214+ new MethodParameter ('integer ' , new Integer ())
215+ ]
216+ ),
217+ ],
218+ $ docblock ->getTags ()
219+ );
220+
221+ }
188222}
Original file line number Diff line number Diff line change @@ -95,6 +95,18 @@ public function tagProvider(): array
9595 [new MethodParameter ('a ' , new Mixed_ ())]
9696 ),
9797 ],
98+ [
99+ '@method void setInteger(integer $integer) ' ,
100+ new Method (
101+ 'setInteger ' ,
102+ [],
103+ new Void_ (),
104+ false ,
105+ new Description ('' ),
106+ false ,
107+ [new MethodParameter ('integer ' , new Integer ())]
108+ ),
109+ ],
98110 [
99111 '@method myMethod($a = 1) ' ,
100112 new Method (
You can’t perform that action at this time.
0 commit comments