diff --git a/src/Concerns/ConcreteMagic.php b/src/Concerns/ConcreteMagic.php index f7f7d09..38a3cdb 100644 --- a/src/Concerns/ConcreteMagic.php +++ b/src/Concerns/ConcreteMagic.php @@ -13,7 +13,6 @@ namespace Guanguans\SoarPHP\Concerns; use Guanguans\SoarPHP\Exceptions\InvalidOptionException; -use Symfony\Component\VarDumper\VarDumper; /** * @mixin \Guanguans\SoarPHP\Soar @@ -52,9 +51,7 @@ public function __wakeup(): void public function __debugInfo(): array { - $debugInfo = ['commandLine' => (string) $this]; - - return class_exists(VarDumper::class) ? $debugInfo : get_object_vars($this) + $debugInfo; + return $this->mergeDebugInfo(['commandLine' => (string) $this]); } /** diff --git a/src/Concerns/WithDumpable.php b/src/Concerns/WithDumpable.php index b69f7ad..0087ce6 100644 --- a/src/Concerns/WithDumpable.php +++ b/src/Concerns/WithDumpable.php @@ -46,4 +46,9 @@ public function dump(...$args): self return $this; } + + private function mergeDebugInfo(array $debugInfo): array + { + return class_exists(VarDumper::class) ? $debugInfo : get_object_vars($this) + $debugInfo; + } }