The formattening, part 3

This commit is contained in:
2026-05-11 22:41:14 +09:00
parent 00d542ca59
commit 07d132575a
9 changed files with 60 additions and 65 deletions
+24 -16
View File
@@ -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'],
+1 -1
View File
@@ -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());
+1 -1
View File
@@ -45,7 +45,7 @@ class UserManager {
$userFlags = $this->getUsergroups($uname);
if ($userFlags) {
$newFlags = ($userFlags & (~ $group));
$newFlags = ($userFlags & (~$group));
$this->updateFlags($uname, $newFlags);
}
}
+4 -4
View File
@@ -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,
-1
View File
@@ -114,6 +114,5 @@ class DBActivity implements Activity {
}
return null;
}
}
+14 -22
View File
@@ -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 {
+5 -9
View File
@@ -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(),
);
+1 -1
View File
@@ -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 {
+10 -10
View File
@@ -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',
];
}