File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 5
5
use PHPStan \Reflection \ClassReflection ;
6
6
use PHPStan \ShouldNotHappenException ;
7
7
use PHPStan \Type \ObjectType ;
8
+ use Symfony \Component \Console \Command \Command ;
8
9
use function file_exists ;
9
10
use function get_class ;
10
11
use function is_readable ;
@@ -57,8 +58,12 @@ public function findCommands(ClassReflection $classReflection): array
57
58
$ commandClass = new ObjectType (get_class ($ command ));
58
59
$ isLazyCommand = (new ObjectType ('Symfony\Component\Console\Command\LazyCommand ' ))->isSuperTypeOf ($ commandClass )->yes ();
59
60
60
- if ($ isLazyCommand && method_exists ($ command , 'getCommand ' ) && !$ classType ->isSuperTypeOf (new ObjectType (get_class ($ command ->getCommand ())))->yes ()) {
61
- continue ;
61
+ if ($ isLazyCommand && method_exists ($ command , 'getCommand ' )) {
62
+ /** @var Command $wrappedCommand */
63
+ $ wrappedCommand = $ command ->getCommand ();
64
+ if (!$ classType ->isSuperTypeOf (new ObjectType (get_class ($ wrappedCommand )))->yes ()) {
65
+ continue ;
66
+ }
62
67
}
63
68
64
69
if (!$ isLazyCommand && !$ classType ->isSuperTypeOf ($ commandClass )->yes ()) {
You can’t perform that action at this time.
0 commit comments