Skip to content

Commit 4dba4e0

Browse files
committed
fixup! dont use array_find_key. Only in php >= 8.4
1 parent 01fe26b commit 4dba4e0

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

library/Icinga/Web/Form/ConfigSectionForm.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,19 @@ protected function addRequiredElements(): void
341341
$this->addSectionNameElement();
342342

343343
$content = $this->getContent();
344-
$index = array_find_key($content, function ($element) {
345-
return $element->getName() === static::NAME_ELEMENT_NAME;
346-
});
347-
if ($index === false) {
344+
$index = null;
345+
foreach ($content as $key => $element) {
346+
/** @var FormElement $element */
347+
if ($element->getName() === static::NAME_ELEMENT_NAME) {
348+
$index = $key;
349+
break;
350+
}
351+
}
352+
353+
if ($index === null) {
348354
throw new LogicException('Could not find section name element');
349355
}
356+
350357
$element = $content[$index];
351358
unset($content[$index]);
352359
array_unshift($content, $element);

0 commit comments

Comments
 (0)