From 9088c10f38641f62c4fe7e037b44088645e0e60e Mon Sep 17 00:00:00 2001 From: Hamza Alayed Date: Tue, 25 Feb 2025 18:00:05 +0300 Subject: [PATCH] Fix PHP8.4 deprecations notice --- src/Models/exceptions/AuthExipredException.php | 2 +- src/Models/exceptions/CommandException.php | 2 +- src/Models/exceptions/RateLimitException.php | 2 +- src/Models/exceptions/UnderMaintenanceException.php | 2 +- src/Models/submissions/properties/Scanning.php | 6 +++--- src/Models/submissions/properties/Webhooks.php | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Models/exceptions/AuthExipredException.php b/src/Models/exceptions/AuthExipredException.php index 2e26b78..721e436 100644 --- a/src/Models/exceptions/AuthExipredException.php +++ b/src/Models/exceptions/AuthExipredException.php @@ -29,7 +29,7 @@ class AuthExipredException extends Exception { - public function __construct($code = 0, Exception $previous = null) + public function __construct($code = 0, ?Exception $previous = null) { parent::__construct("Authentication Expired. Need to login again.", $code, $previous); } diff --git a/src/Models/exceptions/CommandException.php b/src/Models/exceptions/CommandException.php index e484140..7f2da8d 100644 --- a/src/Models/exceptions/CommandException.php +++ b/src/Models/exceptions/CommandException.php @@ -29,7 +29,7 @@ class CommandException extends Exception { - public function __construct($error, $code = 0, Exception $previous = null) + public function __construct($error, $code = 0, ?Exception $previous = null) { parent::__construct($error, $code, $previous); } diff --git a/src/Models/exceptions/RateLimitException.php b/src/Models/exceptions/RateLimitException.php index e41d1ea..d504543 100644 --- a/src/Models/exceptions/RateLimitException.php +++ b/src/Models/exceptions/RateLimitException.php @@ -29,7 +29,7 @@ class RateLimitException extends Exception { - public function __construct($code = 0, Exception $previous = null) + public function __construct($code = 0, ?Exception $previous = null) { parent::__construct("Too many requests. Please wait before calling again.", $code, $previous); } diff --git a/src/Models/exceptions/UnderMaintenanceException.php b/src/Models/exceptions/UnderMaintenanceException.php index 12fb1be..a840bf3 100644 --- a/src/Models/exceptions/UnderMaintenanceException.php +++ b/src/Models/exceptions/UnderMaintenanceException.php @@ -29,7 +29,7 @@ class UnderMaintenanceException extends Exception { - public function __construct($code = 0, Exception $previous = null) + public function __construct($code = 0, ?Exception $previous = null) { parent::__construct("Copyleaks is Under Maintenance, please visit https://status.copyleaks.com", $code, $previous); } diff --git a/src/Models/submissions/properties/Scanning.php b/src/Models/submissions/properties/Scanning.php index 0b16e7c..a06dd46 100644 --- a/src/Models/submissions/properties/Scanning.php +++ b/src/Models/submissions/properties/Scanning.php @@ -52,9 +52,9 @@ class SubmissionScanning */ public function __construct( bool $internet = false, - SubmissionScanningExclude $exclude = null, - array $repositories = null, - SubmissionScanningCopyleaksDB $copyleaksDb = null + ?SubmissionScanningExclude $exclude = null, + ?array $repositories = null, + ?SubmissionScanningCopyleaksDB $copyleaksDb = null ) { $this->internet = $internet; $this->exclude = $exclude; diff --git a/src/Models/submissions/properties/Webhooks.php b/src/Models/submissions/properties/Webhooks.php index f05b85d..6d3e9c0 100644 --- a/src/Models/submissions/properties/Webhooks.php +++ b/src/Models/submissions/properties/Webhooks.php @@ -44,9 +44,9 @@ class SubmissionWebhooks * @param string status This webhook event is triggered once the scan status changes. Use the special token {STATUS} to track the current scan status. This special token will automatically be replaced by the Copyleaks servers with the optional values: completed, error, creditsChecked and indexed. Read more about webhooks: https://api.copyleaks.com/documentation/v3/webhooks * @param string newResult Http endpoint to be triggered while the scan is still running and a new result is found. This is useful when the report is being viewed by the user in real time so the results will load gradually as they are found. */ - public function __construct(string $status, string $newResult = null) + public function __construct(string $status, ?string $newResult = null) { $this->newResult = $newResult; - $this->status = $status; + $this->status = $status; } }