@@ -124,8 +124,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
124
124
$ fileCountLength = strlen ((string )$ totalFiles );
125
125
126
126
if ($ this ->verbose ) {
127
- $ output ->writeln ('' );
128
- $ output ->writeln ('PHP Docblock Checker <fg=blue>by Dan Cryer (https://www.dancryer.com)</> ' );
127
+ $ output ->writeln ('<fg=blue>PHPDoc Checker</> ' );
129
128
$ output ->writeln ('' );
130
129
}
131
130
@@ -179,7 +178,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
179
178
}
180
179
181
180
if ($ error ['type ' ] == 'method ' ) {
182
- $ this ->output ->write ('Method <info> ' . $ error ['method ' ] . '</info> is missing a docblock. ' );
181
+ $ this ->output ->write ('Method <info> ' . $ error ['class ' ] . ' :: ' . $ error [ ' method ' ] . '</info> is missing a docblock. ' );
183
182
}
184
183
185
184
$ this ->output ->writeln ('' );
@@ -191,19 +190,19 @@ protected function execute(InputInterface $input, OutputInterface $output)
191
190
$ this ->output ->write ('<fg=yellow>WARNING </> ' );
192
191
193
192
if ($ error ['type ' ] == 'param-missing ' ) {
194
- $ this ->output ->write ('<info> ' . $ error ['method ' ] . '</info> - @param <fg=blue> ' .$ error ['param ' ] . '</> missing. ' );
193
+ $ this ->output ->write ('<info> ' . $ error ['class ' ] . ' :: ' . $ error [ ' method ' ] . '</info> - @param <fg=blue> ' .$ error ['param ' ] . '</> missing. ' );
195
194
}
196
195
197
196
if ($ error ['type ' ] == 'param-mismatch ' ) {
198
- $ this ->output ->write ('<info> ' . $ error ['method ' ] . '</info> - @param <fg=blue> ' .$ error ['param ' ] . '</> ( ' .$ error ['doc-type ' ].') does not match method signature ( ' .$ error ['param-type ' ].'). ' );
197
+ $ this ->output ->write ('<info> ' . $ error ['class ' ] . ' :: ' . $ error [ ' method ' ] . '</info> - @param <fg=blue> ' .$ error ['param ' ] . '</> ( ' .$ error ['doc-type ' ].') does not match method signature ( ' .$ error ['param-type ' ].'). ' );
199
198
}
200
199
201
200
if ($ error ['type ' ] == 'return-missing ' ) {
202
- $ this ->output ->write ('<info> ' . $ error ['method ' ] . '</info> - @return missing. ' );
201
+ $ this ->output ->write ('<info> ' . $ error ['class ' ] . ' :: ' . $ error [ ' method ' ] . '</info> - @return missing. ' );
203
202
}
204
203
205
204
if ($ error ['type ' ] == 'return-mismatch ' ) {
206
- $ this ->output ->write ('<info> ' . $ error ['method ' ] . '</info> - @return <fg=blue> ' .$ error ['doc-type ' ] . '</> does not match method signature ( ' .$ error ['return-type ' ].'). ' );
205
+ $ this ->output ->write ('<info> ' . $ error ['class ' ] . ' :: ' . $ error [ ' method ' ] . '</info> - @return <fg=blue> ' .$ error ['doc-type ' ] . '</> does not match method signature ( ' .$ error ['return-type ' ].'). ' );
207
206
}
208
207
209
208
$ this ->output ->writeln ('' );
@@ -267,10 +266,10 @@ protected function processFile($file)
267
266
if (is_null ($ class ['docblock ' ])) {
268
267
$ errors = true ;
269
268
$ this ->errors [] = [
270
- 'type ' => 'class ' ,
271
- 'file ' => $ file ,
272
- 'class ' => $ name ,
273
- 'line ' => $ class ['line ' ],
269
+ 'type ' => 'class ' ,
270
+ 'file ' => $ file ,
271
+ 'class ' => $ class [ ' name ' ] ,
272
+ 'line ' => $ class ['line ' ],
274
273
];
275
274
}
276
275
}
@@ -281,11 +280,11 @@ protected function processFile($file)
281
280
if (is_null ($ method ['docblock ' ])) {
282
281
$ errors = true ;
283
282
$ this ->errors [] = [
284
- 'type ' => 'method ' ,
285
- 'file ' => $ file ,
286
- 'class ' => $ name ,
287
- 'method ' => $ name ,
288
- 'line ' => $ method ['line ' ],
283
+ 'type ' => 'method ' ,
284
+ 'file ' => $ file ,
285
+ 'class ' => $ method [ ' class ' ] ,
286
+ 'method ' => $ method [ ' name ' ] ,
287
+ 'line ' => $ method ['line ' ],
289
288
];
290
289
}
291
290
}
@@ -298,27 +297,27 @@ protected function processFile($file)
298
297
if (!isset ($ method ['docblock ' ]['params ' ][$ param ])) {
299
298
$ warnings = true ;
300
299
$ this ->warnings [] = [
301
- 'type ' => 'param-missing ' ,
302
- 'file ' => $ file ,
303
- 'class ' => $ name ,
304
- 'method ' => $ name ,
305
- 'line ' => $ method ['line ' ],
306
- 'param ' => $ param ,
300
+ 'type ' => 'param-missing ' ,
301
+ 'file ' => $ file ,
302
+ 'class ' => $ method [ ' class ' ] ,
303
+ 'method ' => $ method [ ' name ' ] ,
304
+ 'line ' => $ method ['line ' ],
305
+ 'param ' => $ param ,
307
306
];
308
307
} elseif (!empty ($ type ) && $ method ['docblock ' ]['params ' ][$ param ] != $ type ) {
309
308
if ($ type == 'array ' && substr ($ method ['docblock ' ]['params ' ][$ param ], -2 ) == '[] ' ) {
310
309
// Do nothing because this is fine.
311
310
} else {
312
311
$ warnings = true ;
313
312
$ this ->warnings [] = [
314
- 'type ' => 'param-mismatch ' ,
315
- 'file ' => $ file ,
316
- 'class ' => $ name ,
317
- 'method ' => $ name ,
318
- 'line ' => $ method ['line ' ],
319
- 'param ' => $ param ,
313
+ 'type ' => 'param-mismatch ' ,
314
+ 'file ' => $ file ,
315
+ 'class ' => $ method [ ' class ' ] ,
316
+ 'method ' => $ method [ ' name ' ] ,
317
+ 'line ' => $ method ['line ' ],
318
+ 'param ' => $ param ,
320
319
'param-type ' => $ type ,
321
- 'doc-type ' => $ method ['docblock ' ]['params ' ][$ param ],
320
+ 'doc-type ' => $ method ['docblock ' ]['params ' ][$ param ],
322
321
];
323
322
}
324
323
}
@@ -330,25 +329,25 @@ protected function processFile($file)
330
329
if (empty ($ method ['docblock ' ]['return ' ])) {
331
330
$ warnings = true ;
332
331
$ this ->warnings [] = [
333
- 'type ' => 'return-missing ' ,
334
- 'file ' => $ file ,
335
- 'class ' => $ name ,
336
- 'method ' => $ name ,
337
- 'line ' => $ method ['line ' ],
332
+ 'type ' => 'return-missing ' ,
333
+ 'file ' => $ file ,
334
+ 'class ' => $ method [ ' class ' ] ,
335
+ 'method ' => $ method [ ' name ' ] ,
336
+ 'line ' => $ method ['line ' ],
338
337
];
339
338
} elseif (is_array ($ method ['return ' ])) {
340
339
$ docblockTypes = explode ('| ' , $ method ['docblock ' ]['return ' ]);
341
340
sort ($ docblockTypes );
342
341
if ($ method ['return ' ] != $ docblockTypes ) {
343
342
$ warnings = true ;
344
343
$ this ->warnings [] = [
345
- 'type ' => 'return-mismatch ' ,
346
- 'file ' => $ file ,
347
- 'class ' => $ name ,
348
- 'method ' => $ name ,
349
- 'line ' => $ method ['line ' ],
344
+ 'type ' => 'return-mismatch ' ,
345
+ 'file ' => $ file ,
346
+ 'class ' => $ method [ ' class ' ] ,
347
+ 'method ' => $ method [ ' name ' ] ,
348
+ 'line ' => $ method ['line ' ],
350
349
'return-type ' => implode ('| ' , $ method ['return ' ]),
351
- 'doc-type ' => $ method ['docblock ' ]['return ' ],
350
+ 'doc-type ' => $ method ['docblock ' ]['return ' ],
352
351
];
353
352
}
354
353
} elseif ($ method ['docblock ' ]['return ' ] != $ method ['return ' ]) {
@@ -357,13 +356,13 @@ protected function processFile($file)
357
356
} else {
358
357
$ warnings = true ;
359
358
$ this ->warnings [] = [
360
- 'type ' => 'return-mismatch ' ,
361
- 'file ' => $ file ,
362
- 'class ' => $ name ,
363
- 'method ' => $ name ,
364
- 'line ' => $ method ['line ' ],
359
+ 'type ' => 'return-mismatch ' ,
360
+ 'file ' => $ file ,
361
+ 'class ' => $ method [ ' class ' ] ,
362
+ 'method ' => $ method [ ' name ' ] ,
363
+ 'line ' => $ method ['line ' ],
365
364
'return-type ' => $ method ['return ' ],
366
- 'doc-type ' => $ method ['docblock ' ]['return ' ],
365
+ 'doc-type ' => $ method ['docblock ' ]['return ' ],
367
366
];
368
367
}
369
368
}
0 commit comments