Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 4aa9ca6

Browse files
authored
Merge pull request #28 from reactphp-parallel/include-class-name-in-hash
Include class name in hash
2 parents fd3e212 + bcdf454 commit 4aa9ca6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Proxy.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ public function create(object $object, string $interface): object
9292
throw NonExistentInterface::create($interface);
9393
}
9494

95-
$class = self::KNOWN_INTERFACE[$interface];
96-
$hash = bin2hex(random_bytes(13));
95+
$class = self::KNOWN_INTERFACE[$interface];
96+
$instance = new Instance($object, $interface);
97+
$hash = $instance->class() . '___' . bin2hex(random_bytes(13));
9798

98-
$this->instances[$hash] = new Instance($object, $interface);
99+
$this->instances[$hash] = $instance;
99100

100101
if ($this->counterCreate instanceof Counters) {
101102
$this->counterCreate->counter(new Label('class', $this->instances[$hash]->class()), new Label('interface', $interface))->incr();

0 commit comments

Comments
 (0)