Skip to content

Commit d71bbe6

Browse files
committed
Downgrade array_find_key usage to support PHP 8.2
1 parent 094abdb commit d71bbe6

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/Resolver/TemplateChain/DataObject/TemplateChain.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,22 @@ private function findChildInsertPosition(TemplateTypeInterface $parent): int
114114

115115
private function findIndexByFullyQualifiedName(string $fullyQualifiedName): ?int
116116
{
117-
return array_find_key($this->chain, static fn($item) => $item->getFullyQualifiedName() === $fullyQualifiedName);
117+
foreach ($this->chain as $key => $templateType) {
118+
if ($templateType->getFullyQualifiedName() === $fullyQualifiedName) {
119+
return $key;
120+
}
121+
}
122+
return null;
118123
}
119124

120125
private function findIndexByModuleId(string $moduleId): ?int
121126
{
122-
return array_find_key($this->chain, static fn($item) => $item->getNamespace() === $moduleId);
127+
foreach ($this->chain as $key => $templateType) {
128+
if ($templateType->getNamespace() === $moduleId) {
129+
return $key;
130+
}
131+
}
132+
return null;
123133
}
124134

125135
private function findByModuleIdInternal(string $moduleId): ?TemplateTypeInterface

0 commit comments

Comments
 (0)