You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you might know php's foreach variable after as will be set and can be accessed later down the code i.e.
$items = [1, 2, 3];
foreach ($itemsas$item) {
// do something with the $item
}
var_dump($item) // 3 => will return the last item in the array
I found this in RouteCollection class
protectedfunctionaddToCollections($route)
{
$domainAndUri = $route->getDomain().$route->uri();
foreach ($route->methods() as$method) {
$this->routes[$method][$domainAndUri] = $route;
}
// $this->allRoutes will only have the last method present in $route->methods()$this->allRoutes[$method.$domainAndUri] = $route;
}
For example if $route->methods() returns ['GET', 'HEAD']. Only HEAD will be added to allRoutes.
I don't know but I find this unexpected and weird, is this intended behavior?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As you might know php's
foreach
variable afteras
will be set and can be accessed later down the code i.e.I found this in
RouteCollection
classFor example if
$route->methods()
returns['GET', 'HEAD']
. OnlyHEAD
will be added toallRoutes
.I don't know but I find this unexpected and weird, is this intended behavior?
Beta Was this translation helpful? Give feedback.
All reactions