Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Commit 83ccb47

Browse files
author
Sam Edwards
committed
Move checking for tree inheritance inside count > 1 conditional to prevent issues when debugging with a single class
1 parent edea772 commit 83ccb47

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/Blade.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,23 @@ protected function setBladeData($data)
1616
// Get __blade/__debugger key
1717
$this->data = $data['__data']['__blade'];
1818

19-
// Get first item from data array
20-
$first = reset($this->data);
21-
22-
// Get last item from data array
19+
// Only worry about rewriting data if we have more than one class
2320
if (count($this->data) > 1) {
21+
// Get first item from data array
22+
$first = reset($this->data);
23+
24+
// Get last item from data array
2425
$last = end($this->data);
25-
}
2626

27-
// If last item does not inherit tree and first class is App
28-
if (!$last->tree && $first->class === 'App') {
29-
// Rewrite $this->data with first (App) and last item in array
30-
$this->data = [$first, $last];
31-
// Else if $last does not inherit tree
32-
} elseif (!$last->tree) {
33-
// Rewrite $this->data with last item in array
34-
$this->data = $last;
27+
// If last item does not inherit tree and first class is App
28+
if (!$last->tree && $first->class === 'App') {
29+
// Rewrite $this->data with first (App) and last item in array
30+
$this->data = [$first, $last];
31+
// Else if $last does not inherit tree
32+
} elseif (!$last->tree) {
33+
// Rewrite $this->data with last item in array
34+
$this->data = $last;
35+
}
3536
}
3637

3738
return $this;

0 commit comments

Comments
 (0)