-
-
Notifications
You must be signed in to change notification settings - Fork 191
Fix deprecation notice in route name extraction #543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@X-Coder264, nice catch! We indeed missed that. I did some refactors and added some more tests, I hope you do not mind 😄 (CI seems to have some temporary issues at the moment, will retry them later) |
@stayallive Since you went and refactored a bunch of code, just one more thing that I've noticed.
The return type is nullable even though // /someaction // Fallback to the url
if (empty($routeName) || $routeName === 'Closure') {
$routeName = '/' . ltrim($route->uri(), '/');
}
return $routeName; If $routeName is null Also np for the refactors, those are always welcome 😄 |
Yep, good catch! Copy pasta error :) |
You changed the return type of |
Yep, I should take some time to read better, both were "wrong" though 👍 |
Now that the return type was narrowed And $routeName = Integration::extractNameForRoute($route) ?? '<unlabeled transaction>'; in $routeName = Integration::extractNameForRoute($route); |
Thanks for the PR and the feedback @X-Coder264, 2.11.1 with this fix should be released soon 💪 |
Cool, thank you for such a quick review / merging / release tagging process. |
We just updated one of our projects from Laravel 8 and PHP 8.0 to Laravel 9 and PHP 8.1 and immediately
str_ends_with(): Passing null to parameter #1 ($haystack) of type string is deprecated in /code/vendor/laravel/framework/src/Illuminate/Support/Str.php on line 247
started popping up on Sentry (as we have the deprecation logger configured for the app).
Turns out there is a code path here that triggers that deprecation (specifically the code path when the route has no name so Laravel auto generates the name for the route).
This PR fixes that deprecation and adds tests for the method that this PR touched.