From c0ffe97491ee16bbcd69b4ddc22e28f0dd82afe1 Mon Sep 17 00:00:00 2001 From: cwhite Date: Tue, 20 Jun 2023 12:00:54 -0500 Subject: [PATCH] Show CliDumper source content on last line --- src/Illuminate/Foundation/Console/CliDumper.php | 2 +- tests/Foundation/Console/CliDumperTest.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Foundation/Console/CliDumper.php b/src/Illuminate/Foundation/Console/CliDumper.php index beed2f2af9f4..304dfcb0c351 100644 --- a/src/Illuminate/Foundation/Console/CliDumper.php +++ b/src/Illuminate/Foundation/Console/CliDumper.php @@ -94,7 +94,7 @@ public function dumpWithSource(Data $data) $output = (string) $this->dump($data, true); $lines = explode("\n", $output); - $lines[0] .= $this->getDumpSourceContent(); + $lines[array_key_last($lines) - 1] .= $this->getDumpSourceContent(); $this->output->write(implode("\n", $lines)); diff --git a/tests/Foundation/Console/CliDumperTest.php b/tests/Foundation/Console/CliDumperTest.php index c8a9281dacde..c92245f9a703 100644 --- a/tests/Foundation/Console/CliDumperTest.php +++ b/tests/Foundation/Console/CliDumperTest.php @@ -55,7 +55,7 @@ public function testArray() $output = $this->dump(['string', 1, 1.1, ['string', 1, 1.1]]); $expected = <<<'EOF' - array:4 [ // app/routes/console.php:18 + array:4 [ 0 => "string" 1 => 1 2 => 1.1 @@ -64,7 +64,7 @@ public function testArray() 1 => 1 2 => 1.1 ] - ] + ] // app/routes/console.php:18 EOF; @@ -90,9 +90,9 @@ public function testObject() $objectId = spl_object_id($user); $expected = <<