Skip to content

Commit 7a8d2b4

Browse files
authored
Check implementation instead of assuming it is View
1 parent ebd009c commit 7a8d2b4

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/Watchers/ViewWatcher.php

+10-7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Contracts\View\Factory;
77
use Illuminate\Support\Str;
88
use Illuminate\View\View;
9+
use Illuminate\Contracts\View\View as ViewContract;
910
use Laravel\Telescope\IncomingEntry;
1011
use Laravel\Telescope\Telescope;
1112
use ReflectionFunction;
@@ -38,15 +39,17 @@ public function recordAction($event, $data)
3839
return;
3940
}
4041

41-
/** @var View $view */
42+
/** @var ViewContract $view */
4243
$view = $data[0];
4344

44-
Telescope::recordView(IncomingEntry::make(array_filter([
45-
'name' => $view->getName(),
46-
'path' => $this->extractPath($view),
47-
'data' => $this->extractKeysFromData($view),
48-
'composers' => $this->formatComposers($view),
49-
])));
45+
if ($view instanceof View) {
46+
Telescope::recordView(IncomingEntry::make(array_filter([
47+
'name' => $view->getName(),
48+
'path' => $this->extractPath($view),
49+
'data' => $this->extractKeysFromData($view),
50+
'composers' => $this->formatComposers($view),
51+
])));
52+
}
5053
}
5154

5255
/**

0 commit comments

Comments
 (0)