Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary code in DefinitionStorage #101

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion src/DefinitionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading