Skip to content

Commit

Permalink
rector: ChangeAndIfToEarlyReturnRector (#4126)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
staabm and kodiakhq[bot] committed Nov 28, 2020
1 parent c645f27 commit 470b9d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
1 change: 1 addition & 0 deletions .tools/rector/rector.php
Expand Up @@ -44,4 +44,5 @@
// we will grow this rector list step by step.
// after some basic rectors have been enabled we can finally enable whole-sets (when diffs get stable and reviewable)
$services->set(Rector\SOLID\Rector\If_\ChangeAndIfToEarlyReturnRector::class);
$services->set(Rector\SOLID\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector::class);
};
12 changes: 4 additions & 8 deletions redaxo/src/core/lib/form/form.php
Expand Up @@ -386,12 +386,10 @@ protected function save()

// ----- EXTENSION POINT
if ($saved) {
$saved = rex_extension::registerPoint(new rex_extension_point('REX_FORM_SAVED', $saved, ['form' => $this, 'sql' => $sql]));
} else {
$saved = $sql->getMysqlErrno();
return rex_extension::registerPoint(new rex_extension_point('REX_FORM_SAVED', $saved, ['form' => $this, 'sql' => $sql]));
}

return $saved;
return $sql->getMysqlErrno();
}

/**
Expand All @@ -413,11 +411,9 @@ protected function delete()

// ----- EXTENSION POINT
if ($deleted) {
$deleted = rex_extension::registerPoint(new rex_extension_point('REX_FORM_DELETED', $deleted, ['form' => $this, 'sql' => $deleteSql]));
} else {
$deleted = $deleteSql->getMysqlErrno();
return rex_extension::registerPoint(new rex_extension_point('REX_FORM_DELETED', $deleted, ['form' => $this, 'sql' => $deleteSql]));
}

return $deleted;
return $deleteSql->getMysqlErrno();
}
}
6 changes: 2 additions & 4 deletions redaxo/src/core/lib/util/pager.php
Expand Up @@ -89,12 +89,10 @@ public function getRowsPerPage()
public function getCursor($pageNo = null)
{
if (null === $pageNo) {
$cursor = rex_request($this->cursorName, 'int', 0);
} else {
$cursor = $pageNo * $this->rowsPerPage;
return rex_request($this->cursorName, 'int', 0);
}

return $cursor;
return $pageNo * $this->rowsPerPage;
}

/**
Expand Down

0 comments on commit 470b9d0

Please sign in to comment.