1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2025-01-11 10:22:40 +00:00
This commit is contained in:
J. King 2020-01-20 13:52:48 -05:00
parent bbace7a0ac
commit b5f118e8cb
61 changed files with 721 additions and 721 deletions

View file

@ -932,7 +932,7 @@ class Database {
}
/** Returns the time at which any of a user's subscriptions (or a specific subscription) was last refreshed, as a DateTimeImmutable object */
public function subscriptionRefreshed(string $user, int $id = null): ?\DateTimeInterface {
public function subscriptionRefreshed(string $user, int $id = null): ?\DateTimeImmutable {
if (!Arsse::$user->authorize($user, __FUNCTION__)) {
throw new User\ExceptionAuthz("notAuthorized", ["action" => __FUNCTION__, "user" => $user]);
}

View file

@ -390,7 +390,7 @@ class Feed {
return $offset;
}
protected function computeLastModified(): ?\DateTimeInterface {
protected function computeLastModified(): ?\DateTimeImmutable {
if (!$this->modified) {
return $this->lastModified; // @codeCoverageIgnore
}

View file

@ -21,19 +21,19 @@ class Date {
return $out;
}
public static function normalize($date, string $inFormat = null): ?\DateTimeInterface {
public static function normalize($date, string $inFormat = null): ?\DateTimeImmutable {
return ValueInfo::normalize($date, ValueInfo::T_DATE, $inFormat);
}
public static function add($interval, $date = "now"): ?\DateTimeInterface {
public static function add($interval, $date = "now"): ?\DateTimeImmutable {
return self::modify("add", $interval, $date);
}
public static function sub($interval, $date = "now"): ?\DateTimeInterface {
public static function sub($interval, $date = "now"): ?\DateTimeImmutable {
return self::modify("sub", $interval, $date);
}
protected static function modify(string $func, $interval, $date): ?\DateTimeInterface {
protected static function modify(string $func, $interval, $date): ?\DateTimeImmutable {
$date = self::normalize($date);
$interval = (!$interval instanceof \DateInterval) ? ValueInfo::normalize($interval, ValueInfo::T_INTERVAL) : $interval;
return $date ? $date->$func($interval) : null;