Skip to content

Commit

Permalink
Replace functions that are not available in php72
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Jul 16, 2024
1 parent b377ae1 commit 12e7c5e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion application/forms/EscalationConditionForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ protected function handleRemove(): void
unset($this->options[$toRemove]);

if ($this->deleteRemoveButton && count($this->options) === 1) {
$key = array_key_last($this->options);
$key = key($this->options);
$this->options[$key]->remove($this->getElement('remove_' . $key));
}
}
Expand Down
2 changes: 1 addition & 1 deletion application/forms/EscalationRecipientForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ protected function handleRemove(): void
unset($this->options[$toRemove]);

if (count($this->options) === 1) {
$key = array_key_last($this->options);
$key = key($this->options);
$this->options[$key]->remove($this->getElement('remove_' . $key));
}
}
Expand Down
2 changes: 1 addition & 1 deletion application/forms/SaveEventRuleForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ public function editRule(int $id, array $config): void
});

if ($escalationInCache) {
$position = array_key_first($escalationInCache);
$position = key($escalationInCache);
// Escalations in DB to update
$escalationsToUpdate[$position] = $escalationInCache[$position];
unset($escalationsInCache[$position]);
Expand Down
2 changes: 1 addition & 1 deletion library/Notifications/Widget/EventRuleConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function createForms(): void

$addEscalation = (new AddEscalationForm())
->on(AddEscalationForm::ON_SENT, function () use ($escalations) {
$newPosition = (int) array_key_last($escalations) + 1;
$newPosition = count($escalations) + 1;
$this->config['rule_escalation'][$newPosition] = ['id' => $this->generateFakeEscalationId()];
if ($this->config['conditionPlusButtonPosition'] === null) {
$this->config['conditionPlusButtonPosition'] = $newPosition;
Expand Down

0 comments on commit 12e7c5e

Please sign in to comment.