phpstan level 1 errors reduction

This commit is contained in:
marko
2025-11-20 20:02:26 +01:00
parent f28fa7b51b
commit 275b6481cc
40 changed files with 223 additions and 152 deletions

View File

@@ -72,7 +72,7 @@ class Starter
if (is_iterable($result)) {
$this->result = [];
foreach ($result as $r) {
$r = filter_var($r, FILTER_VAR_INT, [
$r = filter_var($r, FILTER_VALIDATE_INT, [
"options" => ["default" => null, "min_range" => 0],
]);
if ($r) {
@@ -142,9 +142,9 @@ class Starter
* @todo an admin should also be allowed
* @todo the deadline of the event should be checked as well
*
* @return int id under which the
* @return ?int id of the added start, null if not added
*/
public function addToDb()
public function addToDb(): ?int
{
// - if the id is already set it *has* to be already in the DB hence we don't add it
// - the logged in user must have wardship over the starter
@@ -464,7 +464,11 @@ class Starter
$startingUser = User::loadFromDb($start->getUserId());
$event = Event::loadFromDb($start->getEventId());
$shiai = Shiai::loadFromDb($event->getShiaiId());
$shiaiId = $event->getShiaiId();
$shiai =
$event->getShiaiId() !== null
? Shiai::loadFromDb($event->getShiaiId())
: null;
$eventDeadline = $event->getDeadline();
$eventDate = $event->getDate();
@@ -497,11 +501,11 @@ class Starter
private static function getHtmlModalToLate($startId, $caption = "Austragen")
{
$modal =
'<a class="btn grey waves-effect waves-light modal-trigger" href="#modal-remove-starter-' .
'<button class="btn grey waves-effect waves-light modal-trigger" popovertarget="modal-remove-starter-' .
$startId .
'">' .
$caption .
"</a>" .
"</button>" .
'<div id="modal-remove-starter-' .
$startId .
'" class="modal" popover>' .
@@ -509,7 +513,9 @@ class Starter
"<p>Das Fenster zum Ein- und Austragen ist bereits geschlossen.</p>" .
"</div>" .
'<div class="modal-footer">' .
'<a href="#!" class="modal-close waves-effect waves-green btn-flat">OK</a>' .
'<button tabindex="0" class="waves-effect waves-green btn-flat" popovertarget="modal-remove-starter-' .
$startId .
'">OK</button>' .
"</div>" .
"</div>";