From 8b70142a9fa901f16cc724c0c2973f7bce53364a Mon Sep 17 00:00:00 2001 From: Natan Felles Date: Thu, 25 Oct 2018 03:47:11 -0300 Subject: [PATCH] Checks if class is instantiable and is a command --- system/CLI/CommandRunner.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/system/CLI/CommandRunner.php b/system/CLI/CommandRunner.php index 46c2e18f68ff..fed9bdada3f6 100644 --- a/system/CLI/CommandRunner.php +++ b/system/CLI/CommandRunner.php @@ -149,6 +149,13 @@ protected function createCommandList() continue; } + $class = new \ReflectionClass($className); + + if ( ! $class->isInstantiable() || ! $class->isSubclassOf(BaseCommand::class)) + { + continue; + } + $class = new $className($this->logger, $this); // Store it!