From 800d02b41194e824f4320df2edc2d9e04374ec09 Mon Sep 17 00:00:00 2001 From: Deeka Wong Date: Thu, 10 Nov 2022 08:18:42 +0800 Subject: [PATCH] Set raw output when using `--execute` (#63) * Set raw output when using `--execute` * Update tests.yaml * Format Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com> --- src/Command/TinkerCommand.php | 4 ++++ src/TinkerCaster.php | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Command/TinkerCommand.php b/src/Command/TinkerCommand.php index 6725472..bcb7b1d 100644 --- a/src/Command/TinkerCommand.php +++ b/src/Command/TinkerCommand.php @@ -89,6 +89,10 @@ public function handle() $this->getCasters() ); + if ($this->input->getOption('execute')) { + $config->setRawOutput(true); + } + $shell = new Shell($config); $shell->addCommands($this->getCommands()); diff --git a/src/TinkerCaster.php b/src/TinkerCaster.php index 1228e1e..3b3a19d 100644 --- a/src/TinkerCaster.php +++ b/src/TinkerCaster.php @@ -12,6 +12,7 @@ use Exception; use ReflectionException; +use ReflectionObject; use Symfony\Component\VarDumper\Caster\Caster; class TinkerCaster @@ -161,7 +162,7 @@ public static function castModel($model) */ public static function castRedis($redis) { - $refObject = new \ReflectionObject($redis); + $refObject = new ReflectionObject($redis); $refProperty = $refObject->getProperty('poolName'); $refProperty->setAccessible(true);