Skip to content
Open
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
9 changes: 5 additions & 4 deletions src/Resolver/Element/ReferenceResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class ReferenceResolver implements ReferenceResolverInterface
];

/**
* @var array<int, array>
* @var array<string, array>
*/
private array $cache = [];

Expand All @@ -40,8 +40,9 @@ public function __construct(private ServiceResolverInterface $serviceResolver)

public function resolve(ElementInterface $element): array
{
if (isset($this->cache[$element->getId()])) {
return $this->cache[$element->getId()];
$cacheKey = $element::class . '_' . $element->getId();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not adding a unit test here. The change is a cache-key correction with no behaviour of its own to assert beyond the collision itself, and the fix was verified against a real installation

if (isset($this->cache[$cacheKey])) {
return $this->cache[$cacheKey];
}

/**
Expand All @@ -54,7 +55,7 @@ public function resolve(ElementInterface $element): array

$data['fullPath'] = $element->getFullPath();

$this->cache[$element->getId()] = $data;
$this->cache[$cacheKey] = $data;

return $data;
}
Expand Down
Loading