rcrowe / TwigBridge

Give the power of Twig to Laravel
MIT License
895 stars 165 forks source link

$path being null causes deprecation warnings in logs when using Telescope #444

Open MaxKorlaar opened 2 months ago

MaxKorlaar commented 2 months ago

When using Laravel Telescope's View Watcher deprecation warnings are emitted for every view that's being watched, thanks to the fact that Twigbridge sets the views' paths to null instead of the actual path:

str_starts_with(): Passing null to parameter #1 ($haystack) of type string is deprecated in /project/vendor/laravel/framework/src/Illuminate/Support/Str.php on line 1439

This is done in EventNode.php: https://github.com/rcrowe/TwigBridge/blob/master/src/Node/EventNode.php#L39C13-L39C17

In Telescope's ViewWatcher.php this path is used in a call to Str::startsWith which in turn uses str_starts_with, and as the warning already implies passing null as the string parameter is deprecated.

Is the path set to null on purpose or would it not be a problem to set it to the view's path?