mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Set return type for hashedids
This commit is contained in:
parent
e0e0c238c6
commit
60a8348ac3
@ -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
|
||||
|
@ -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];
|
||||
|
11
phpstan.neon
11
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/'
|
||||
|
Loading…
Reference in New Issue
Block a user