From 60a8348ac3f3119dfc464e038a6ddc3c9140e2d2 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 24 Jul 2023 10:42:16 +1000 Subject: [PATCH] Set return type for hashedids --- app/Services/Quote/MarkSent.php | 21 ++++++++------------- app/Utils/Traits/MakesHash.php | 3 +-- phpstan.neon | 11 ----------- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/app/Services/Quote/MarkSent.php b/app/Services/Quote/MarkSent.php index 9969cbfc3f41..c6a615efd9a5 100644 --- a/app/Services/Quote/MarkSent.php +++ b/app/Services/Quote/MarkSent.php @@ -11,22 +11,17 @@ namespace App\Services\Quote; -use App\Events\Quote\QuoteWasMarkedSent; -use App\Models\Quote; -use App\Models\Webhook; -use App\Utils\Ninja; use Carbon\Carbon; +use App\Utils\Ninja; +use App\Models\Quote; +use App\Models\Client; +use App\Models\Webhook; +use App\Events\Quote\QuoteWasMarkedSent; class MarkSent { - private $client; - - private $quote; - - public function __construct($client, $quote) + public function __construct(private Client $client, private Quote $quote) { - $this->client = $client; - $this->quote = $quote; } public function run() @@ -38,9 +33,9 @@ class MarkSent $this->quote->markInvitationsSent(); - if ($this->quote->due_date != '' || $this->quote->client->getSetting('valid_until') == '') { + if ($this->quote->due_date != '' || $this->client->getSetting('valid_until') == '') { } else { - $this->quote->due_date = Carbon::parse($this->quote->date)->addDays($this->quote->client->getSetting('valid_until')); + $this->quote->due_date = Carbon::parse($this->quote->date)->addDays($this->client->getSetting('valid_until')); } $this->quote diff --git a/app/Utils/Traits/MakesHash.php b/app/Utils/Traits/MakesHash.php index 72b138795f87..cb8eb996f891 100644 --- a/app/Utils/Traits/MakesHash.php +++ b/app/Utils/Traits/MakesHash.php @@ -62,7 +62,7 @@ trait MakesHash return $hashids->encode($value); } - public function decodePrimaryKey($value) : string + public function decodePrimaryKey($value) : int { try { $hashids = new Hashids(config('ninja.hash_salt'), 10); @@ -71,7 +71,6 @@ trait MakesHash if (! is_array($decoded_array)) { throw new \Exception('Invalid Primary Key'); - //response()->json(['error'=>'Invalid primary key'], 400); } return $decoded_array[0]; diff --git a/phpstan.neon b/phpstan.neon index 8df3f7a00e38..4465c0bdf4ee 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,15 +1,4 @@ -includes: - - ./vendor/nunomaduro/larastan/extension.neon - - phpstan-baseline.neon parameters: - treatPhpDocTypesAsCertain: false - parallel: - jobSize: 10 - maximumNumberOfProcesses: 1 - processTimeout: 60.0 - ignoreErrors: - - '#Call to an undefined method .*badMethod\(\)#' - - '#Call to an undefined method Illuminate\Database\Eloquent\Builder::exclude#' level: 4 paths: - 'app/'