revert PHP 8.4 fixes

Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
Andy Miller 2025-06-12 10:41:38 -06:00
parent 4a22f3dc8d
commit 8811b7aad0
No known key found for this signature in database
GPG Key ID: 9F2CF38AEBDB0AE0

View File

@ -16,14 +16,11 @@ use InvalidArgumentException;
use JsonSerializable; use JsonSerializable;
use Psr\Http\Message\StreamInterface; use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UploadedFileInterface; use Psr\Http\Message\UploadedFileInterface;
use ReturnTypeWillChange;
use RuntimeException; use RuntimeException;
use function copy; use function copy;
use function fopen; use function fopen;
use function is_string; use function is_string;
use function sprintf; use function sprintf;
use const UPLOAD_ERR_NO_FILE;
use const UPLOAD_ERR_OK;
/** /**
* Class FormFlashFile * Class FormFlashFile
@ -32,15 +29,15 @@ use const UPLOAD_ERR_OK;
class FormFlashFile implements UploadedFileInterface, JsonSerializable class FormFlashFile implements UploadedFileInterface, JsonSerializable
{ {
/** @var string */ /** @var string */
private string $id; private $id;
/** @var string */ /** @var string */
private string $field; private $field;
/** @var bool */ /** @var bool */
private bool $moved = false; private $moved = false;
/** @var array */ /** @var array */
private array $upload; private $upload;
/** @var FormFlash */ /** @var FormFlash */
private FormFlash $flash; private $flash;
/** /**
* FormFlashFile constructor. * FormFlashFile constructor.
@ -57,7 +54,7 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable
$tmpFile = $this->getTmpFile(); $tmpFile = $this->getTmpFile();
if (!$tmpFile && $this->isOk()) { if (!$tmpFile && $this->isOk()) {
$this->upload['error'] = UPLOAD_ERR_NO_FILE; $this->upload['error'] = \UPLOAD_ERR_NO_FILE;
} }
if (!isset($this->upload['size'])) { if (!isset($this->upload['size'])) {
@ -68,7 +65,7 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable
/** /**
* @return StreamInterface * @return StreamInterface
*/ */
public function getStream(): StreamInterface public function getStream()
{ {
$this->validateActive(); $this->validateActive();
@ -89,7 +86,7 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable
* @param string $targetPath * @param string $targetPath
* @return void * @return void
*/ */
public function moveTo(string $targetPath): void public function moveTo($targetPath)
{ {
$this->validateActive(); $this->validateActive();
@ -129,7 +126,7 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable
/** /**
* @return int * @return int
*/ */
public function getSize(): int public function getSize()
{ {
return $this->upload['size']; return $this->upload['size'];
} }
@ -137,15 +134,15 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable
/** /**
* @return int * @return int
*/ */
public function getError(): int public function getError()
{ {
return $this->upload['error'] ?? UPLOAD_ERR_OK; return $this->upload['error'] ?? \UPLOAD_ERR_OK;
} }
/** /**
* @return string * @return string
*/ */
public function getClientFilename(): string public function getClientFilename()
{ {
return $this->upload['name'] ?? 'unknown'; return $this->upload['name'] ?? 'unknown';
} }
@ -153,7 +150,7 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable
/** /**
* @return string * @return string
*/ */
public function getClientMediaType(): string public function getClientMediaType()
{ {
return $this->upload['type'] ?? 'application/octet-stream'; return $this->upload['type'] ?? 'application/octet-stream';
} }
@ -181,7 +178,7 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable
/** /**
* @return string * @return string
*/ */
public function getDestination(): string public function getDestination()
{ {
return $this->upload['path'] ?? ''; return $this->upload['path'] ?? '';
} }
@ -189,8 +186,8 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable
/** /**
* @return array * @return array
*/ */
#[ReturnTypeWillChange] #[\ReturnTypeWillChange]
public function jsonSerialize(): array public function jsonSerialize()
{ {
return $this->upload; return $this->upload;
} }
@ -229,7 +226,7 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable
/** /**
* @return array * @return array
*/ */
#[ReturnTypeWillChange] #[\ReturnTypeWillChange]
public function __debugInfo() public function __debugInfo()
{ {
return [ return [
@ -264,6 +261,6 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable
*/ */
private function isOk(): bool private function isOk(): bool
{ {
return UPLOAD_ERR_OK === $this->getError(); return \UPLOAD_ERR_OK === $this->getError();
} }
} }