Skip to content

Commit

Permalink
Optimize StateBinder::hasInjector() method (#1105)
Browse files Browse the repository at this point in the history
  • Loading branch information
anoxia committed May 6, 2024
1 parent a664bae commit 28dc7ea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Core/src/Internal/Config/StateBinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,16 @@ public function removeInjector(string $class): void

public function hasInjector(string $class): bool
{
if (\array_key_exists($class, $this->state->injectors)) {
return true;
}

try {
$reflection = new \ReflectionClass($class);
} catch (\ReflectionException $e) {
throw new ContainerException($e->getMessage(), $e->getCode(), $e);
}

if (\array_key_exists($class, $this->state->injectors)) {
return true;
}

if (
$reflection->implementsInterface(InjectableInterface::class)
&& $reflection->hasConstant('INJECTOR')
Expand Down

0 comments on commit 28dc7ea

Please sign in to comment.