Skip to content

Commit

Permalink
[10.x] Remove useless else statements (#47161)
Browse files Browse the repository at this point in the history
* remove useless else statement in `acquire` method in DynamoDbLock

* remove useless else statement in `getModel` method in Authorize

* remove useless else statement in `formatAction` method in UrlGenerator

* remove useless else statement in `formatPrefix` method in RouteGroup
  • Loading branch information
milwad-dev authored May 22, 2023
1 parent 025b718 commit 1ad5d9b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Illuminate/Auth/Middleware/Authorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ protected function getModel($request, $model)
{
if ($this->isClassName($model)) {
return trim($model);
} else {
return $request->route($model, null) ??
((preg_match("/^['\"](.*)['\"]$/", trim($model), $matches)) ? $matches[1] : null);
}

return $request->route($model, null) ??
((preg_match("/^['\"](.*)['\"]$/", trim($model), $matches)) ? $matches[1] : null);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Cache/DynamoDbLock.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public function acquire()
{
if ($this->seconds > 0) {
return $this->dynamo->add($this->name, $this->owner, $this->seconds);
} else {
return $this->dynamo->add($this->name, $this->owner, 86400);
}

return $this->dynamo->add($this->name, $this->owner, 86400);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Routing/RouteGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ protected static function formatPrefix($new, $old, $prependExistingPrefix = true

if ($prependExistingPrefix) {
return isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old;
} else {
return isset($new['prefix']) ? trim($new['prefix'], '/').'/'.trim($old, '/') : $old;
}

return isset($new['prefix']) ? trim($new['prefix'], '/').'/'.trim($old, '/') : $old;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Routing/UrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,9 @@ protected function formatAction($action)

if ($this->rootNamespace && ! str_starts_with($action, '\\')) {
return $this->rootNamespace.'\\'.$action;
} else {
return trim($action, '\\');
}

return trim($action, '\\');
}

/**
Expand Down

0 comments on commit 1ad5d9b

Please sign in to comment.