File tree Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -177,15 +177,33 @@ private function generateAttributes(): array
177
177
return ['comments ' => [new Doc ($ this ->docBlock ->generate ())]];
178
178
}
179
179
180
- if ($ this ->typed === false || $ this ->docBlockComment !== null ) {
181
- $ docBlockType = new VarTag ( $ this -> type -> types ()) ;
180
+ if ($ this ->typed === false || $ this ->docBlockComment !== null || $ this -> typeDocBlockHint !== null ) {
181
+ $ docBlockType = null ;
182
182
183
+ if ($ this ->type ) {
184
+ $ docBlockType = new VarTag ($ this ->type ->types ());
185
+ }
183
186
if ($ typeHint = $ this ->getTypeDocBlockHint ()) {
184
- $ docBlockType-> setTypes ($ typeHint );
187
+ $ docBlockType = new VarTag ($ typeHint );
185
188
}
186
- $ docBlock = new DocBlock ($ this ->docBlockComment , $ docBlockType );
189
+ $ docBlock = null ;
190
+
191
+ if ($ this ->docBlockComment ) {
192
+ $ docBlock = new DocBlock ($ this ->docBlockComment );
187
193
188
- $ attributes = ['comments ' => [new Doc ($ docBlock ->generate ())]];
194
+ if ($ docBlockType !== null ) {
195
+ $ docBlock ->addTag ($ docBlockType );
196
+ }
197
+ }
198
+ if ($ this ->docBlockComment === null && $ docBlockType !== null ) {
199
+ $ docBlock = new DocBlock ($ this ->docBlockComment , $ docBlockType );
200
+ }
201
+
202
+ if ($ docBlock !== null ) {
203
+ $ docBlock = new DocBlock ($ this ->docBlockComment , $ docBlockType );
204
+
205
+ $ attributes = ['comments ' => [new Doc ($ docBlock ->generate ())]];
206
+ }
189
207
}
190
208
191
209
return $ attributes ;
You can’t perform that action at this time.
0 commit comments