diff --git a/CHANGELOG.md b/CHANGELOG.md index eb38181..237541a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 3.3.1 under development -- no changes in this release. +- 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; }