Skip to content

Commit be3e20c

Browse files
authored
[9.x] Updated to use str_starts_with (#40349)
* Updated to use str_starts_with(). * Style updates.
1 parent 312a557 commit be3e20c

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Illuminate/Routing/Route.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ protected function addGroupNamespaceToStringUses($action)
914914
{
915915
$groupStack = last($this->router->getGroupStack());
916916

917-
if (isset($groupStack['namespace']) && strpos($action, '\\') !== 0) {
917+
if (isset($groupStack['namespace']) && ! str_starts_with($action, '\\')) {
918918
return $groupStack['namespace'].'\\'.$action;
919919
}
920920

src/Illuminate/Routing/RouteGroup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static function merge($new, $old, $prependExistingPrefix = true)
4141
protected static function formatNamespace($new, $old)
4242
{
4343
if (isset($new['namespace'])) {
44-
return isset($old['namespace']) && strpos($new['namespace'], '\\') !== 0
44+
return isset($old['namespace']) && ! str_starts_with($new['namespace'], '\\')
4545
? trim($old['namespace'], '\\').'\\'.trim($new['namespace'], '\\')
4646
: trim($new['namespace'], '\\');
4747
}

src/Illuminate/Routing/Router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ protected function prependGroupNamespace($class)
540540
{
541541
$group = end($this->groupStack);
542542

543-
return isset($group['namespace']) && strpos($class, '\\') !== 0
543+
return isset($group['namespace']) && ! str_starts_with($class, '\\')
544544
? $group['namespace'].'\\'.$class : $class;
545545
}
546546

src/Illuminate/Routing/UrlGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ protected function formatAction($action)
507507
$action = '\\'.implode('@', $action);
508508
}
509509

510-
if ($this->rootNamespace && strpos($action, '\\') !== 0) {
510+
if ($this->rootNamespace && ! str_starts_with($action, '\\')) {
511511
return $this->rootNamespace.'\\'.$action;
512512
} else {
513513
return trim($action, '\\');

0 commit comments

Comments
 (0)