Skip to content

Commit

Permalink
fix: corrected PHP 8.4 deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Nov 6, 2024
1 parent 6d1eb77 commit 7f264e3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions phpmyfaq/src/phpMyFAQ/Attachment/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,15 @@ public function isStorageOk(): bool
}

/**
* Save current attachment to the appropriate storage. The
* filepath given will be processed and moved to appropriate
* location.
* Save current attachment to the appropriate storage.
* The filepath given will be processed and moved to the appropriate location.
*
* @param string $filePath full path to the attachment file
* @param string|null $filename filename to force
* @throws FileException|AttachmentException
* @todo rollback if something went wrong
*/
public function save($filePath, string $filename = null): bool
public function save($filePath, ?string $filename = null): bool
{
$success = false;

Expand All @@ -106,7 +105,7 @@ public function save($filePath, string $filename = null): bool

$targetFile = $this->buildFilePath();

if (null !== $this->id && $this->createSubDirs($targetFile)) {
if ($this->createSubDirs($targetFile)) {
// Doing this check, we're sure not to unnecessarily
// overwrite existing unencrypted file duplicates.
if (!$this->linkedRecords()) {
Expand Down Expand Up @@ -134,7 +133,7 @@ public function save($filePath, string $filename = null): bool
/**
* Delete attachment.
*
* @throws FileException
* @throws FileException|AttachmentException
*/
public function delete(): bool
{
Expand Down Expand Up @@ -182,13 +181,13 @@ public function rawOut($headers = true, $disposition = 'attachment'): void
}

/**
* Factory method to initialise the corresponding file object.
* Factory method to initialize the corresponding file object.
*
* @param string $mode File mode for file open
* @return VanillaFile|EncryptedFile
* @throws AttachmentException
*/
private function getFile($mode = FilesystemFile::MODE_READ)
private function getFile(string $mode = FilesystemFile::MODE_READ): EncryptedFile|VanillaFile
{
if ($this->encrypted) {
return new EncryptedFile(
Expand Down

0 comments on commit 7f264e3

Please sign in to comment.