Use spl_object_id() instead of spl_object_hash()

This commit is contained in:
Jan Rosier
2025-01-02 21:11:52 +01:00
parent 4a871c1196
commit 51bf2ca737
+2 -2
View File
@@ -42,7 +42,7 @@ final class SafeAnalysisNodeVisitor implements NodeVisitorInterface
*/ */
public function getSafe(Node $node) public function getSafe(Node $node)
{ {
$hash = spl_object_hash($node); $hash = spl_object_id($node);
if (!isset($this->data[$hash])) { if (!isset($this->data[$hash])) {
return []; return [];
} }
@@ -64,7 +64,7 @@ final class SafeAnalysisNodeVisitor implements NodeVisitorInterface
private function setSafe(Node $node, array $safe): void private function setSafe(Node $node, array $safe): void
{ {
$hash = spl_object_hash($node); $hash = spl_object_id($node);
if (isset($this->data[$hash])) { if (isset($this->data[$hash])) {
foreach ($this->data[$hash] as &$bucket) { foreach ($this->data[$hash] as &$bucket) {
if ($bucket['key'] === $node) { if ($bucket['key'] === $node) {