diff --git a/CHANGELOG.md b/CHANGELOG.md index a5065a3..cc1f5da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 3.3.1 under development - Bug #100: Fix resolving `ParameterDefinition` for optional parameters with union types (@vjik) +- Enh #101: Minor performance improvement by removing unnecessary code in `DefinitionStorage` (@vjik) ## 3.3.0 March 16, 2024 diff --git a/src/DefinitionStorage.php b/src/DefinitionStorage.php index c9e0459..202cba8 100644 --- a/src/DefinitionStorage.php +++ b/src/DefinitionStorage.php @@ -135,7 +135,8 @@ private function isResolvable(string $id, array $building): bool $parameter = $dependency->getReflection(); $type = $parameter->getType(); - if ($parameter->isVariadic() || $parameter->isOptional()) { + // This condition covers variadic parameters, because variadic parameter is optional + if ($parameter->isOptional()) { /** @infection-ignore-all Mutation don't change behaviour, but degrade performance. */ break; }