From 19e0ad604ac83cb0e7bb724981838f707e68eeff Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Fri, 11 Mar 2022 10:38:31 -0600 Subject: [PATCH] PHP8 phpstan fix (#13843) --- LibreNMS/Exceptions/FileWriteFailedException.php | 7 ++++--- phpstan-baseline.neon | 5 ----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/LibreNMS/Exceptions/FileWriteFailedException.php b/LibreNMS/Exceptions/FileWriteFailedException.php index f82a276533..e39b717d48 100644 --- a/LibreNMS/Exceptions/FileWriteFailedException.php +++ b/LibreNMS/Exceptions/FileWriteFailedException.php @@ -29,11 +29,12 @@ use Throwable; class FileWriteFailedException extends \Exception { - protected $file; + /** @var string */ + protected $file_path; public function __construct($file, $code = 0, Throwable $previous = null) { - $this->file = $file; + $this->file_path = $file; parent::__construct("Failed to write file: $file", $code, $previous); } @@ -45,7 +46,7 @@ class FileWriteFailedException extends \Exception public function render(\Illuminate\Http\Request $request) { $title = trans('exceptions.file_write_failed.title'); - $message = trans('exceptions.file_write_failed.message', ['file' => $this->file]); + $message = trans('exceptions.file_write_failed.message', ['file' => $this->file_path]); return $request->wantsJson() ? response()->json([ 'status' => 'error', diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a0db042ec6..45221032db 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -2670,11 +2670,6 @@ parameters: count: 1 path: LibreNMS/Exceptions/FileWriteFailedException.php - - - message: "#^Property LibreNMS\\\\Exceptions\\\\FileWriteFailedException\\:\\:\\$file has no type specified\\.$#" - count: 1 - path: LibreNMS/Exceptions/FileWriteFailedException.php - - message: "#^Method LibreNMS\\\\Exceptions\\\\HostUnreachableException\\:\\:addReason\\(\\) has no return type specified\\.$#" count: 1