mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Static analysis cleanup
This commit is contained in:
parent
82784582f0
commit
0792638e90
@ -13,35 +13,35 @@ namespace App\DataMapper;
|
||||
|
||||
class FeesAndLimits
|
||||
{
|
||||
public $min_limit = -1; //equivalent to null
|
||||
public float $min_limit = -1; //equivalent to null
|
||||
|
||||
public $max_limit = -1; //equivalent to null
|
||||
public float $max_limit = -1; //equivalent to null
|
||||
|
||||
public $fee_amount = 0;
|
||||
public float $fee_amount = 0;
|
||||
|
||||
public $fee_percent = 0;
|
||||
public float $fee_percent = 0;
|
||||
|
||||
public $fee_tax_name1 = '';
|
||||
public string $fee_tax_name1 = '';
|
||||
|
||||
public $fee_tax_name2 = '';
|
||||
public string $fee_tax_name2 = '';
|
||||
|
||||
public $fee_tax_name3 = '';
|
||||
public string $fee_tax_name3 = '';
|
||||
|
||||
public $fee_tax_rate1 = 0;
|
||||
public float $fee_tax_rate1 = 0;
|
||||
|
||||
public $fee_tax_rate2 = 0;
|
||||
public float $fee_tax_rate2 = 0;
|
||||
|
||||
public $fee_tax_rate3 = 0;
|
||||
public float $fee_tax_rate3 = 0;
|
||||
|
||||
public $fee_cap = 0;
|
||||
public float $fee_cap = 0;
|
||||
|
||||
public $adjust_fee_percent = false;
|
||||
public bool $adjust_fee_percent = false;
|
||||
|
||||
public $is_enabled = true;
|
||||
public bool $is_enabled = true;
|
||||
|
||||
//public $gateway_type_id = 1;
|
||||
|
||||
public static $casts = [
|
||||
public static array $casts = [
|
||||
'is_enabled' => 'bool',
|
||||
'gateway_type_id' => 'int',
|
||||
'min_limit' => 'float',
|
||||
|
@ -22,7 +22,9 @@ class UploadMigrationFileRequest extends Request
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->user()->isAdmin();
|
||||
/** @var \App\Models\User $user */
|
||||
$user = auth()->user();
|
||||
return $user->isAdmin();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -30,7 +32,7 @@ class UploadMigrationFileRequest extends Request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'migration' => [],
|
||||
|
@ -64,12 +64,12 @@ class RefundPaymentRequest extends Request
|
||||
$this->replace($input);
|
||||
}
|
||||
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
$rules = [
|
||||
'id' => 'bail|required',
|
||||
'id' => 'bail|required', //@phpstan-ignore-line
|
||||
'id' => new ValidRefundableRequest($input),
|
||||
'amount' => 'numeric',
|
||||
'date' => 'required',
|
||||
|
@ -46,8 +46,8 @@ class ValidRefundableRequest implements Rule
|
||||
return false;
|
||||
}
|
||||
|
||||
/**@var \App\Models\Payment $payment */
|
||||
$payment = Payment::whereId($this->input['id'])->withTrashed()->first();
|
||||
/**@var \App\Models\Payment $payment **/
|
||||
$payment = Payment::where('id', $this->input['id'])->withTrashed()->first();
|
||||
|
||||
if (! $payment) {
|
||||
$this->error_msg = ctrans('texts.unable_to_retrieve_payment');
|
||||
@ -56,7 +56,6 @@ class ValidRefundableRequest implements Rule
|
||||
}
|
||||
|
||||
$request_invoices = request()->has('invoices') ? $this->input['invoices'] : [];
|
||||
// $request_credits = request()->has('credits') ? $this->input['credits'] : [];
|
||||
|
||||
if ($payment->invoices()->exists()) {
|
||||
foreach ($payment->invoices as $paymentable_invoice) {
|
||||
@ -77,8 +76,8 @@ class ValidRefundableRequest implements Rule
|
||||
|
||||
private function checkInvoiceIsPaymentable($invoice, $payment)
|
||||
{
|
||||
/**@var \App\Models\Invoice $invoice */
|
||||
$invoice = Invoice::whereId($invoice['invoice_id'])->whereCompanyId($payment->company_id)->withTrashed()->first();
|
||||
/**@var \App\Models\Invoice $invoice **/
|
||||
$invoice = Invoice::where('id', $invoice['invoice_id'])->where('company_id', $payment->company_id)->withTrashed()->first();
|
||||
|
||||
if (! $invoice) {
|
||||
$this->error_msg = 'Invoice not found for refund';
|
||||
|
@ -35,25 +35,26 @@ use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundExceptio
|
||||
* @property \App\Models\Company $company
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel|Illuminate\Database\Eloquent\Relations\BelongsTo|\Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo|\App\Models\Company company()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel|Illuminate\Database\Eloquent\Relations\HasMany|BaseModel orderBy()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder exclude($columns)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder company()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder with($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder newModelQuery($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder newQuery($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder exclude(array $excludeable)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder withTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder scopeExclude($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel company()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel with($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel newModelQuery($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel newQuery($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude(array $excludeable)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel|\Illuminate\Database\Query\Builder withTrashed(bool $withTrashed = true)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scopeExclude($query)
|
||||
* @method static BaseModel find($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder whereIn($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder where($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder count()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder create($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder insert($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder service()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder orderBy($column, $direction)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder invitations()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder whereHas($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel whereId($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel whereIn($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel where($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel count()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel create($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel insert($query)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel service()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel orderBy($column, $direction)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel invitations()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel whereHas($query)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\InvoiceInvitation | \App\Models\CreditInvitation | \App\Models\QuoteInvitation | \App\Models\RecurringInvoiceInvitation> $invitations
|
||||
* @property-read int|null $invitations_count
|
||||
*
|
||||
|
@ -132,6 +132,8 @@ use App\Events\Invoice\InvoiceReminderWasEmailed;
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Payment> $payments
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
|
||||
* @property object|null $tax_data
|
||||
* @method static \Illuminate\Database\Eloquent\Builder company()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder withTrashed(bool $withTrashed = true)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Invoice extends BaseModel
|
||||
|
@ -92,6 +92,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Invoice> $invoices
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Paymentable> $paymentables
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder withTrashed(bool $withTrashed = true)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Payment extends BaseModel
|
||||
|
@ -1,7 +1,7 @@
|
||||
includes:
|
||||
- ./vendor/nunomaduro/larastan/extension.neon
|
||||
parameters:
|
||||
level: 4
|
||||
level: 2
|
||||
paths:
|
||||
- 'app/'
|
||||
excludePaths:
|
||||
|
Loading…
Reference in New Issue
Block a user