Skip to content

Firefly III: a personal finances manager

PHP 7.2 specific code.

James Cole6ed31dc4c9b5
diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php
index 39bb6eb94e..dab8e627ac 100644
--- a/app/Helpers/Attachments/AttachmentHelper.php
+++ b/app/Helpers/Attachments/AttachmentHelper.php
@@ -182,13 +182,17 @@ class AttachmentHelper implements AttachmentHelperInterface
/**
* Save attachments that get uploaded with models, through the app.
*
- * @param Model $model
+ * @param object $model
* @param array|null $files
*
* @return bool
+ * @throws \Illuminate\Contracts\Encryption\EncryptException
*/
- public function saveAttachmentsForModel(Model $model, ?array $files): bool
+ public function saveAttachmentsForModel(object $model, ?array $files): bool
{
+ if(!($model instanceof Model)) {
+ return false;
+ }
Log::debug(sprintf('Now in saveAttachmentsForModel for model %s', \get_class($model)));
if (\is_array($files)) {
Log::debug('$files is an array.');
diff --git a/app/Helpers/Attachments/AttachmentHelperInterface.php b/app/Helpers/Attachments/AttachmentHelperInterface.php
index 7305202738..8671e4f677 100644
--- a/app/Helpers/Attachments/AttachmentHelperInterface.php
+++ b/app/Helpers/Attachments/AttachmentHelperInterface.php
@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Helpers\Attachments;
use FireflyIII\Models\Attachment;
-use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
@@ -84,10 +83,10 @@ interface AttachmentHelperInterface
/**
* Save attachments that got uploaded.
*
- * @param Model $model
+ * @param object $model
* @param null|array $files
*
* @return bool
*/
- public function saveAttachmentsForModel(Model $model, ?array $files): bool;
+ public function saveAttachmentsForModel(object $model, ?array $files): bool;
}