Skip to content

Commit

Permalink
int case after isset
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Oct 26, 2023
1 parent 5e4edda commit fff12bb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/models/NavItemPageBlockItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,10 @@ public function eventAfterUpdate($event)
{
$this->updateNavItemTimesamp();
if (!empty($this->_olds)) {

$oldPlaceholderVar = $this->_olds['placeholder_var'] ?? false;
$oldPrevId = (int) $this->_olds['prev_id'] ?? 0;
$oldPrevId = isset($this->_olds['prev_id']) ? (int) $this->_olds['prev_id'] : 0;

if ($oldPlaceholderVar != $this->placeholder_var || $oldPrevId != $this->prev_id) {
$this->reindex($this->nav_item_page_id, $oldPlaceholderVar, $oldPrevId);
}
Expand Down Expand Up @@ -250,7 +252,7 @@ public function eventAfterDelete()
{
$this->updateNavItemTimesamp();
if (!empty($this->_olds)) {
$this->reindex($this->_olds['nav_item_page_id'], $this->_olds['placeholder_var'], $this->_olds['prev_id']);
$this->reindex($this->_olds['nav_item_page_id'] ?? 0, $this->_olds['placeholder_var'] ?? null, $this->_olds['prev_id'] ?? 0);
}
}

Expand Down Expand Up @@ -299,9 +301,9 @@ private function deleteAllSubBlocks($blockId)
/**
* Reindex the page block items in order to get requestd sorting.
*
* @param unknown $navItemPageId
* @param unknown $placeholderVar
* @param unknown $prevId
* @param string|int $navItemPageId
* @param string $placeholderVar
* @param string|int $prevId
*/
private function reindex($navItemPageId, $placeholderVar, $prevId)
{
Expand Down

0 comments on commit fff12bb

Please sign in to comment.