Skip to content

Commit

Permalink
refactor(src): Improve __debugInfo method
Browse files Browse the repository at this point in the history
- Updated the __debugInfo method in ConcreteMagic.php
- Added a check for the existence of Symfony\Component\VarDumper\VarDumper class
- Adjusted the return statement based on the class existence
  • Loading branch information
guanguans committed Feb 22, 2024
1 parent 9cb4186 commit 46c38c7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Concerns/ConcreteMagic.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace Guanguans\SoarPHP\Concerns;

use Guanguans\SoarPHP\Exceptions\InvalidOptionException;
use Symfony\Component\VarDumper\VarDumper;

/**
* @mixin \Guanguans\SoarPHP\Soar
Expand Down Expand Up @@ -51,7 +52,9 @@ public function __wakeup(): void

public function __debugInfo(): array
{
return get_object_vars($this) + ['commandLine' => (string) $this];
$debugInfo = ['commandLine' => (string) $this];

return class_exists(VarDumper::class) ? $debugInfo : get_object_vars($this) + $debugInfo;
}

/**
Expand Down

0 comments on commit 46c38c7

Please sign in to comment.