fix: APIHelper에서 tryCache가 잘못된 타입 지정인 버그
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class APICacheResult{
|
||||
function __construct(
|
||||
public ?\DateTimeInterface $lastModified,
|
||||
public ?string $etag,
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user