Skip to content

Commit 2dfa739

Browse files
committed
Reset singletons
1 parent 2dd0c86 commit 2dfa739

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/container/src/GenericContainer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Tempest\Reflection\TypeReflector;
2222
use Throwable;
2323
use UnitEnum;
24+
use const ARRAY_FILTER_USE_BOTH;
2425

2526
final class GenericContainer implements Container
2627
{
@@ -64,7 +65,7 @@ public function setDefinitions(array $definitions): self
6465

6566
public function setSingletons(array $singletons): self
6667
{
67-
$this->resolvedSingletons = new ArrayIterator($singletons);
68+
$this->singletonDefinitions = new ArrayIterator($singletons);
6869

6970
return $this;
7071
}
@@ -100,7 +101,7 @@ public function getDefinitions(): array
100101
*/
101102
public function getSingletons(?string $interface = null): array
102103
{
103-
$singletons = $this->resolvedSingletons->getArrayCopy();
104+
$singletons = $this->singletonDefinitions->getArrayCopy();
104105

105106
if (is_null($interface)) {
106107
return $singletons;
@@ -109,7 +110,7 @@ public function getSingletons(?string $interface = null): array
109110
return array_filter(
110111
array: $singletons,
111112
callback: static fn (mixed $_, string $key) => str_starts_with($key, "{$interface}#") || $key === $interface,
112-
mode: \ARRAY_FILTER_USE_BOTH,
113+
mode: ARRAY_FILTER_USE_BOTH,
113114
);
114115
}
115116

0 commit comments

Comments
 (0)