fix: APIHelper에서 tryCache가 잘못된 타입 지정인 버그

This commit is contained in:
2022-04-01 23:27:04 +09:00
parent 8ab79ad9f4
commit b24c4806f5
3 changed files with 15 additions and 3 deletions
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace sammo;
class APICacheResult{
function __construct(
public ?\DateTimeInterface $lastModified,
public ?string $etag,
)
{
}
}
+2 -2
View File
@@ -82,8 +82,8 @@ class APIHelper
$cacheResult = $obj->tryCache();
if ($cacheResult !== null) {
/** @var \DateTimeInterface $lastModified */
[$lastModified, $etag] = $cacheResult;
$lastModified = $cacheResult->lastModified;
$etag = $cacheResult->etag;
if ($lastModified !== null) {
header("Last-Modified: " . gmdate("D, d M Y H:i:s", Util::toInt(TimeUtil::DateTimeToSeconds($lastModified, true))) . " GMT");
+1 -1
View File
@@ -22,7 +22,7 @@ abstract class BaseAPI
/** @return null|string|array */
abstract function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag);
public function tryCache():?string{
public function tryCache():?APICacheResult{
return null;
}
}