Mark data classes and functions with types

This commit is contained in:
2025-12-17 03:41:40 +09:00
parent da1113341a
commit f8acc4b815
20 changed files with 496 additions and 343 deletions
+25 -12
View File
@@ -4,38 +4,51 @@ declare(strict_types=1);
namespace pvv\side\social;
use DateTimeImmutable;
use pvv\side\Activity;
class AnimekveldActivity implements Activity {
public function nextDate(\DateTimeImmutable $date) {
if (intval($date->format('H')) > 20 || intval($date->format('H')) === 19 && intval($date->format('i')) > 30) {
return $this->nextDate($date->add(new \DateInterval('P1D'))->setTime(19, 30, 0));
public function nextDate(\DateTimeImmutable $date): DateTimeImmutable {
if (
intval($date->format("H")) > 20 ||
(intval($date->format("H")) === 19 && intval($date->format("i")) > 30)
) {
return $this->nextDate(
$date->add(new \DateInterval("P1D"))->setTime(19, 30, 0),
);
}
$date = $date->setTime(19, 30, 0);
if (intval($date->format('N')) !== 5) {
return $this->nextDate($date->add(new \DateInterval('P1D')));
if (intval($date->format("N")) !== 5) {
return $this->nextDate($date->add(new \DateInterval("P1D")));
}
return $date;
}
public function prevDate(\DateTimeImmutable $date) {
if (intval($date->format('H')) < 19 || intval($date->format('H')) === 20 && intval($date->format('i')) < 30) {
return $this->prevDate($date->sub(new \DateInterval('P1D'))->setTime(19, 30, 0));
public function prevDate(\DateTimeImmutable $date): DateTimeImmutable {
if (
intval($date->format("H")) < 19 ||
(intval($date->format("H")) === 20 && intval($date->format("i")) < 30)
) {
return $this->prevDate(
$date->sub(new \DateInterval("P1D"))->setTime(19, 30, 0),
);
}
$date = $date->setTime(19, 30, 0);
if (intval($date->format('N')) !== 5) {
return $this->prevDate($date->sub(new \DateInterval('P1D')));
if (intval($date->format("N")) !== 5) {
return $this->prevDate($date->sub(new \DateInterval("P1D")));
}
return $date;
}
public function getNextEventFrom(\DateTimeImmutable $date) { /* : Event */
public function getNextEventFrom(\DateTimeImmutable $date): AnimekveldEvent {
return new AnimekveldEvent($this->nextDate($date));
}
public function getPreviousEventFrom(\DateTimeImmutable $date) { /* : Event */
public function getPreviousEventFrom(
\DateTimeImmutable $date,
): AnimekveldEvent {
return new AnimekveldEvent($this->prevDate($date));
}
}