diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 9661ad1..05df088 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -20,24 +20,32 @@ $finder = (new PhpCsFixer\Finder()) return (new PhpCsFixer\Config()) ->setRiskyAllowed(true) ->setRules([ - '@PhpCsFixer' => true, - '@Symfony' => true, '@PER-CS' => true, - '@PHP71Migration' => true, - '@PHP73Migration' => true, - '@PHP74Migration' => true, - '@PHP80Migration' => true, - '@PHP81Migration' => true, - '@PHP82Migration' => true, - '@PHP83Migration' => true, - '@PHP84Migration' => true, - - '@PhpCsFixer:risky' => true, - '@Symfony:risky' => true, '@PER-CS:risky' => true, - '@PHP74Migration:risky' => true, - '@PHP80Migration:risky' => true, - '@PHP82Migration:risky' => true, + '@PhpCsFixer' => true, + '@PhpCsFixer:risky' => true, + '@Symfony' => true, + '@Symfony:risky' => true, + + '@PHP7x0Migration' => true, + '@PHP7x0Migration:risky' => true, + '@PHP7x1Migration' => true, + '@PHP7x1Migration:risky' => true, + '@PHP7x3Migration' => true, + '@PHP7x4Migration' => true, + '@PHP7x4Migration:risky' => true, + '@PHP8x0Migration' => true, + '@PHP8x0Migration:risky' => true, + '@PHP8x1Migration' => true, + '@PHP8x1Migration:risky' => true, + '@PHP8x2Migration' => true, + '@PHP8x2Migration:risky' => true, + '@PHP8x3Migration' => true, + '@PHP8x3Migration:risky' => true, + '@PHP8x4Migration' => true, + '@PHP8x4Migration:risky' => true, + '@PHP8x5Migration' => true, + '@PHP8x5Migration:risky' => true, 'strict_param' => true, 'array_syntax' => ['syntax' => 'short'], diff --git a/src/_autoload.php b/src/_autoload.php index cbc15da..1fc90fa 100644 --- a/src/_autoload.php +++ b/src/_autoload.php @@ -38,4 +38,4 @@ declare(strict_types=1); */ spl_autoload_extensions('.php'); spl_autoload_register('spl_autoload'); -set_include_path(realpath(__DIR__) . \PATH_SEPARATOR . get_include_path()); +set_include_path(realpath(__DIR__).\PATH_SEPARATOR.get_include_path()); diff --git a/src/pvv/admin/usermanager.php b/src/pvv/admin/usermanager.php index 8126840..8ce76c5 100644 --- a/src/pvv/admin/usermanager.php +++ b/src/pvv/admin/usermanager.php @@ -45,7 +45,7 @@ class UserManager { $userFlags = $this->getUsergroups($uname); if ($userFlags) { - $newFlags = ($userFlags & (~ $group)); + $newFlags = ($userFlags & (~$group)); $this->updateFlags($uname, $newFlags); } } diff --git a/src/pvv/side/agenda.php b/src/pvv/side/agenda.php index 191e2b5..4db868b 100644 --- a/src/pvv/side/agenda.php +++ b/src/pvv/side/agenda.php @@ -58,7 +58,7 @@ class Agenda { } usort( $result, - static fn($a, $b) => $a->getStart() < $b->getStart() ? -1 : 1, + static fn ($a, $b) => $a->getStart() < $b->getStart() ? -1 : 1, ); return $result; @@ -98,14 +98,14 @@ class Agenda { public function getNextOfEach(\DateTimeImmutable $startDate): array { $result = array_filter( array_map( - static fn($a) => $a->getNextEventFrom($startDate), + static fn ($a) => $a->getNextEventFrom($startDate), $this->activities, ), - static fn($a) => isset($a), + static fn ($a) => isset($a), ); usort( $result, - static fn($a, $b) => $a->getStart()->getTimeStamp() + static fn ($a, $b) => $a->getStart()->getTimeStamp() < $b->getStart()->getTimeStamp() ? -1 : 1, diff --git a/src/pvv/side/dbactivity.php b/src/pvv/side/dbactivity.php index 0bcf7c3..1752446 100644 --- a/src/pvv/side/dbactivity.php +++ b/src/pvv/side/dbactivity.php @@ -114,6 +114,5 @@ class DBActivity implements Activity { } return null; - } } diff --git a/src/pvv/side/door.php b/src/pvv/side/door.php index 817ac23..740bf92 100644 --- a/src/pvv/side/door.php +++ b/src/pvv/side/door.php @@ -4,18 +4,16 @@ declare(strict_types=1); namespace pvv\side; -use DateTimeImmutable; - class DoorStatus { - private DateTimeImmutable $time; + private \DateTimeImmutable $time; private bool $open; - public function __construct(DateTimeImmutable $time, bool $open) { + public function __construct(\DateTimeImmutable $time, bool $open) { $this->time = $time; $this->open = $open; } - public function getTime(): DateTimeImmutable { + public function getTime(): \DateTimeImmutable { return $this->time; } @@ -31,7 +29,7 @@ class DoorStatus { class Door { private $pdo; - const DAYS_OF_DOOR_HISTORY = 7; + public const DAYS_OF_DOOR_HISTORY = 7; public function __construct(\PDO $pdo) { $this->pdo = $pdo; @@ -52,12 +50,10 @@ class Door { $statement->execute(); $result = array_map( - function ($row) { - return new DoorStatus( - (new DateTimeImmutable)->setTimestamp((int) $row['time']), - (bool) $row['open'], - ); - }, + static fn ($row) => new DoorStatus( + new \DateTimeImmutable()->setTimestamp((int) $row['time']), + (bool) $row['open'], + ), $statement->fetchAll(), ); @@ -81,12 +77,10 @@ class Door { $statement->execute(); $result = array_map( - function ($row) { - return new DoorStatus( - (new DateTimeImmutable)->setTimestamp((int) $row['time']), - (bool) $row['open'], - ); - }, + static fn ($row) => new DoorStatus( + new \DateTimeImmutable()->setTimestamp((int) $row['time']), + (bool) $row['open'], + ), $statement->fetchAll(), ); @@ -110,12 +104,10 @@ class Door { return null; } - $result = new DoorStatus( - (new DateTimeImmutable)->setTimestamp((int) $row['time']), + return new DoorStatus( + new \DateTimeImmutable()->setTimestamp((int) $row['time']), (bool) $row['open'], ); - - return $result; } private function removeOld(): void { diff --git a/src/pvv/side/motd.php b/src/pvv/side/motd.php index dcc63e9..d8d0b01 100644 --- a/src/pvv/side/motd.php +++ b/src/pvv/side/motd.php @@ -67,12 +67,10 @@ class MOTD { $data = $statement->fetch(); - $result = new MOTDItem( + return new MOTDItem( $data['title'], explode("\n", $data['content']), ); - - return $result; } /** @@ -92,12 +90,10 @@ class MOTD { $statement->execute(); $result = array_map( - function ($item) { - return new MOTDItem( - $item['title'], - explode("\n", $item['content']), - ); - }, + static fn ($item) => new MOTDItem( + $item['title'], + explode("\n", $item['content']), + ), $statement->fetchAll(), ); diff --git a/src/pvv/side/simpleevent.php b/src/pvv/side/simpleevent.php index 38a89bd..59dc9eb 100644 --- a/src/pvv/side/simpleevent.php +++ b/src/pvv/side/simpleevent.php @@ -57,7 +57,7 @@ class SimpleEvent extends Event { } public function getURL(): string { - return '/hendelser/info.php?id=' . $this->id; + return '/hendelser/info.php?id='.$this->id; } public function getImageURL(): string { diff --git a/src/pvv/side/social/brettspillevent.php b/src/pvv/side/social/brettspillevent.php index dc7f728..f6f67c9 100644 --- a/src/pvv/side/social/brettspillevent.php +++ b/src/pvv/side/social/brettspillevent.php @@ -34,27 +34,27 @@ class BrettspillEvent extends Event { public function getDescription(): array { return [ 'Er du en hardcore brettspillentusiast eller en nybegynner som har så vidt spilt ludo? ' - . 'Da er vår brettspillkveld noe for deg! ' - . 'Vi tar ut et par spill fra vårt samling of spiller så mye vi orker. Kom innom!', + .'Da er vår brettspillkveld noe for deg! ' + .'Vi tar ut et par spill fra vårt samling of spiller så mye vi orker. Kom innom!', '', '## Vår samling', '', - '* Dominion\\*', + '* Dominion\*', '* Three cheers for master', '* Avalon', '* Hanabi', - '* Cards aginst humanity\\*', + '* Cards aginst humanity\*', '* Citadels', - '* Munchkin\\*\\*', - '* Exploding kittens\\*\\*', + '* Munchkin\*\*', + '* Exploding kittens\*\*', '* Aye dark overlord', - '* Settlers of catan\\*', - '* Risk\\*\\*', + '* Settlers of catan\*', + '* Risk\*\*', '* og mange flere...', '', - '\\* Vi har flere ekspansjoner til spillet', + '\* Vi har flere ekspansjoner til spillet', '', - '\\*\\* Vi har flere varianter av spillet', + '\*\* Vi har flere varianter av spillet', ]; }