@@ -194,15 +194,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
194
194
}
195
195
196
196
if ($ error ['type ' ] == 'param-mismatch ' ) {
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 ' ].'). ' );
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 ' ].'). ' );
198
198
}
199
199
200
200
if ($ error ['type ' ] == 'return-missing ' ) {
201
201
$ this ->output ->write ('<info> ' . $ error ['class ' ] . ':: ' . $ error ['method ' ] . '</info> - @return missing. ' );
202
202
}
203
203
204
204
if ($ error ['type ' ] == 'return-mismatch ' ) {
205
- $ this ->output ->write ('<info> ' . $ error ['class ' ] . ':: ' . $ 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 ' ].'). ' );
206
206
}
207
207
208
208
$ this ->output ->writeln ('' );
@@ -323,7 +323,10 @@ protected function processFile($file)
323
323
];
324
324
}
325
325
} elseif (!empty ($ type ) && $ method ['docblock ' ]['params ' ][$ param ] !== $ type ) {
326
- if ($ type === 'array ' && substr ($ method ['docblock ' ]['params ' ][$ param ], -2 ) === '[] ' ) {
326
+ if (
327
+ ($ type === 'array ' && substr ($ method ['docblock ' ]['params ' ][$ param ], -2 ) === '[] ' )
328
+ || $ method ['docblock ' ]['params ' ][$ param ] === 'mixed '
329
+ ) {
327
330
// Do nothing because this is fine.
328
331
} else {
329
332
$ warnings = true ;
@@ -345,6 +348,10 @@ protected function processFile($file)
345
348
346
349
if (!empty ($ method ['return ' ])) {
347
350
if (empty ($ method ['docblock ' ]['return ' ])) {
351
+ // https://bugs.php.net/bug.php?id=75263
352
+ if ($ method ['name ' ] === '__construct ' ) {
353
+ continue ;
354
+ }
348
355
$ warnings = true ;
349
356
$ this ->warnings [] = [
350
357
'type ' => 'return-missing ' ,
@@ -368,7 +375,11 @@ protected function processFile($file)
368
375
];
369
376
}
370
377
} elseif ($ method ['docblock ' ]['return ' ] !== $ method ['return ' ]) {
371
- if ($ method ['return ' ] === 'array ' && substr ($ method ['docblock ' ]['return ' ], -2 ) === '[] ' ) {
378
+ if (
379
+ ($ method ['return ' ] === 'array ' && substr ($ method ['docblock ' ]['return ' ], -2 ) === '[] ' )
380
+ || $ method ['docblock ' ]['return ' ] === 'mixed '
381
+ || (strpos ($ method ['docblock ' ]['return ' ], '| ' ) !== false && PHP_MAJOR_VERSION < 8 )
382
+ ) {
372
383
// Do nothing because this is fine.
373
384
} else {
374
385
$ warnings = true ;
0 commit comments