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 21
21
use phpDocumentor \Reflection \DocBlock \TagFactory ;
22
22
use phpDocumentor \Reflection \DocBlock \Tags \Factory \AbstractPHPStanFactory ;
23
23
use phpDocumentor \Reflection \DocBlock \Tags \Factory \Factory ;
24
+ use phpDocumentor \Reflection \DocBlock \Tags \Factory \MethodFactory ;
24
25
use phpDocumentor \Reflection \DocBlock \Tags \Factory \ParamFactory ;
25
26
use phpDocumentor \Reflection \DocBlock \Tags \Factory \PropertyFactory ;
26
27
use phpDocumentor \Reflection \DocBlock \Tags \Factory \PropertyReadFactory ;
@@ -77,6 +78,7 @@ public static function createInstance(array $additionalTags = []): DocBlockFacto
77
78
new PropertyFactory ($ typeResolver , $ descriptionFactory ),
78
79
new PropertyReadFactory ($ typeResolver , $ descriptionFactory ),
79
80
new PropertyWriteFactory ($ typeResolver , $ descriptionFactory ),
81
+ new MethodFactory ($ typeResolver , $ descriptionFactory )
80
82
);
81
83
82
84
$ tagFactory ->addService ($ descriptionFactory );
Original file line number Diff line number Diff line change 17
17
use phpDocumentor \Reflection \DocBlock \Description ;
18
18
use phpDocumentor \Reflection \DocBlock \StandardTagFactory ;
19
19
use phpDocumentor \Reflection \DocBlock \Tag ;
20
+ use phpDocumentor \Reflection \DocBlock \Tags \Method ;
21
+ use phpDocumentor \Reflection \DocBlock \Tags \MethodParameter ;
20
22
use phpDocumentor \Reflection \DocBlock \Tags \Param ;
21
23
use phpDocumentor \Reflection \DocBlock \Tags \See ;
22
24
use phpDocumentor \Reflection \Types \Array_ ;
23
25
use phpDocumentor \Reflection \Types \Integer ;
24
26
use phpDocumentor \Reflection \Types \String_ ;
27
+ use phpDocumentor \Reflection \Types \Void_ ;
25
28
use PHPUnit \Framework \TestCase ;
26
29
27
30
/**
@@ -185,4 +188,35 @@ public function testMultilineTags(): void
185
188
);
186
189
187
190
}
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
+ }
188
222
}
Original file line number Diff line number Diff line change @@ -95,6 +95,18 @@ public function tagProvider(): array
95
95
[new MethodParameter ('a ' , new Mixed_ ())]
96
96
),
97
97
],
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
+ ],
98
110
[
99
111
'@method myMethod($a = 1) ' ,
100
112
new Method (
You can’t perform that action at this time.
0 commit comments