Skip to content

Commit

Permalink
Filters out non-reflected parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyaldape committed Jul 25, 2024
1 parent b18f333 commit ef98043
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Illuminate/Routing/ResolvesRouteDependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public function resolveMethodDependencies(array $parameters, ReflectionFunctionA
{
$instanceCount = 0;

// filters out non-reflected parameters
$parameters = array_filter($parameters, function ($index) use ($reflector) {
return in_array($index, array_map(fn ($parameter) => $parameter->name, $reflector->getParameters()));
}, ARRAY_FILTER_USE_KEY);

$values = array_values($parameters);

$skippableValue = new stdClass;
Expand Down Expand Up @@ -73,7 +78,7 @@ public function resolveMethodDependencies(array $parameters, ReflectionFunctionA
protected function transformDependency(ReflectionParameter $parameter, $parameters, $skippableValue)
{
$className = Reflector::getParameterClassName($parameter);

dd($className);
// 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.
Expand Down

0 comments on commit ef98043

Please sign in to comment.