Skip to content

Commit

Permalink
fix problem with fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Nov 9, 2021
1 parent 0940624 commit 5fda5a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/RouteRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function __call($method, $parameters)
return $this->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters);
}

return $this->attribute($method, $parameters[0] ?? true);
return $this->attribute($method, array_key_exists(0, $parameters) ? $parameters[0] : true);

This comment has been minimized.

Copy link
@hicham-saddek

hicham-saddek Nov 13, 2021

Why not use $parameters[0] ?? true

This comment has been minimized.

Copy link
@nguyenhiepvan

nguyenhiepvan Nov 15, 2021

i prefer \Arr::get($parameters,0,true)

This comment has been minimized.

Copy link
@hicham-saddek

hicham-saddek Nov 15, 2021

Agreed

}

throw new BadMethodCallException(sprintf(
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,6 @@ public function __call($method, $parameters)
return (new RouteRegistrar($this))->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters);
}

return (new RouteRegistrar($this))->attribute($method, $parameters[0] ?? true);
return (new RouteRegistrar($this))->attribute($method, array_key_exists(0, $parameters) ? $parameters[0] : true);
}
}

0 comments on commit 5fda5a3

Please sign in to comment.