Skip to content

Commit

Permalink
Show CliDumper source content on last line (laravel#48707)
Browse files Browse the repository at this point in the history
  • Loading branch information
calebdw authored and timacdonald committed Oct 24, 2023
1 parent f9df7ab commit 107023c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/CliDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
8 changes: 4 additions & 4 deletions tests/Foundation/Console/CliDumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -64,7 +64,7 @@ public function testArray()
1 => 1
2 => 1.1
]
]
] // app/routes/console.php:18

EOF;

Expand All @@ -90,9 +90,9 @@ public function testObject()
$objectId = spl_object_id($user);

$expected = <<<EOF
{#$objectId // app/routes/console.php:18
{#$objectId
+"name": "Guus"
}
} // app/routes/console.php:18
EOF;

Expand Down

0 comments on commit 107023c

Please sign in to comment.