Skip to content
Permalink
Browse files

formatting

  • Loading branch information
taylorotwell committed Mar 12, 2020
1 parent 4638617 commit c666c424e8a60539a8fbd7cb5a3474785d9db22a
Showing with 9 additions and 9 deletions.
  1. +9 −9 src/Illuminate/Routing/RouteDependencyResolverTrait.php
@@ -41,12 +41,12 @@ public function resolveMethodDependencies(array $parameters, ReflectionFunctionA

$values = array_values($parameters);

$shouldSkipValue = new \stdClass;
$skippableValue = new \stdClass;

foreach ($reflector->getParameters() as $key => $parameter) {
$instance = $this->transformDependency($parameter, $parameters, $shouldSkipValue);
$instance = $this->transformDependency($parameter, $parameters, $skippableValue);

if ($instance !== $shouldSkipValue) {
if ($instance !== $skippableValue) {
$instanceCount++;

$this->spliceIntoParameters($parameters, $key, $instance);
@@ -64,23 +64,23 @@ public function resolveMethodDependencies(array $parameters, ReflectionFunctionA
*
* @param \ReflectionParameter $parameter
* @param array $parameters
* @param object $shouldSkipValue
* @param object $skippableValue
* @return mixed
*/
protected function transformDependency(ReflectionParameter $parameter, $parameters, $shouldSkipValue)
protected function transformDependency(ReflectionParameter $parameter, $parameters, $skippableValue)
{
$class = $parameter->getClass();

// If the parameter has a type-hinted class, we will check to see if it is already in
// the list of parameters. If it is we will just skip it as it is probably a model
// binding and we do not want to mess with those; otherwise, we resolve it here.
if ($class && ! $this->alreadyInParameters($class->name, $parameters)) {
// If it has a default value and is not already resolved, it's
// probably an optional model binding not present in the url.
return $parameter->isDefaultValueAvailable() ? null : $this->container->make($class->name);
return $parameter->isDefaultValueAvailable()
? null
: $this->container->make($class->name);
}

return $shouldSkipValue;
return $skippableValue;
}

/**

0 comments on commit c666c42

Please sign in to comment.
You can’t perform that action at this time.