File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 55use PHPStan \Reflection \ClassReflection ;
66use PHPStan \ShouldNotHappenException ;
77use PHPStan \Type \ObjectType ;
8+ use Symfony \Component \Console \Command \Command ;
89use function file_exists ;
910use function get_class ;
1011use function is_readable ;
@@ -57,8 +58,12 @@ public function findCommands(ClassReflection $classReflection): array
5758 $ commandClass = new ObjectType (get_class ($ command ));
5859 $ isLazyCommand = (new ObjectType ('Symfony\Component\Console\Command\LazyCommand ' ))->isSuperTypeOf ($ commandClass )->yes ();
5960
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+ }
6267 }
6368
6469 if (!$ isLazyCommand && !$ classType ->isSuperTypeOf ($ commandClass )->yes ()) {
You can’t perform that action at this time.
0 commit comments