Skip to content

Commit

Permalink
Improve phpstan detection
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor committed Jan 20, 2024
1 parent 0fb1c39 commit 3bd2adb
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 6 deletions.
11 changes: 7 additions & 4 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
includes:
- vendor/nunomaduro/larastan/extension.neon
- vendor/larastan/larastan/extension.neon
parameters:
level: 5
checkMissingIterableValueType: false
paths:
- src/
- config/
- database/
- routes/
databaseMigrationsPath:
- database/migrations/
- vendor/orchestra/testbench-core/laravel/migrations/
level: 5
checkMissingIterableValueType: false
ignoreErrors:
- '#^Unsafe usage of new static#'
- '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model::#'
2 changes: 0 additions & 2 deletions src/Interfaces/Itemable.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ public function findItem(array $attributes): ?Item;

/**
* Merge the given item into the collection.
*
* @param \Cone\Bazar\Models\Item $items
*/
public function mergeItem(Item $item): Item;

Expand Down
4 changes: 4 additions & 0 deletions src/Models/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public function addressable(): MorphTo

/**
* Get the alias attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string|null, never>
*/
protected function alias(): Attribute
{
Expand All @@ -148,6 +150,8 @@ protected function alias(): Attribute

/**
* Get the name attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function name(): Attribute
{
Expand Down
10 changes: 10 additions & 0 deletions src/Models/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ public function itemable(): MorphTo

/**
* Get the formatted price attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function formattedPrice(): Attribute
{
Expand All @@ -139,6 +141,8 @@ protected function formattedPrice(): Attribute

/**
* Get the total attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<float, never>
*/
protected function total(): Attribute
{
Expand All @@ -149,6 +153,8 @@ protected function total(): Attribute

/**
* Get the formatted total attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function formattedTotal(): Attribute
{
Expand All @@ -159,6 +165,8 @@ protected function formattedTotal(): Attribute

/**
* Get the subtotal attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<float, never>
*/
protected function subtotal(): Attribute
{
Expand All @@ -169,6 +177,8 @@ protected function subtotal(): Attribute

/**
* Get the formatted subtotal attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function formattedSubtotal(): Attribute
{
Expand Down
6 changes: 6 additions & 0 deletions src/Models/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ public function transactions(): HasMany

/**
* Get the payments attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<\Illuminate\Support\Collection, never>
*/
protected function payments(): Attribute
{
Expand All @@ -173,6 +175,8 @@ protected function payments(): Attribute

/**
* Get the refunds attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<\Illuminate\Support\Collection, never>
*/
protected function refunds(): Attribute
{
Expand All @@ -185,6 +189,8 @@ protected function refunds(): Attribute

/**
* Get the status name attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function statusName(): Attribute
{
Expand Down
4 changes: 4 additions & 0 deletions src/Models/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public static function formatCurrency(string $currency, Closure $callback): void

/**
* Get the currency attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function currency(): Attribute
{
Expand All @@ -46,6 +48,8 @@ protected function currency(): Attribute

/**
* Get the currency symbol attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function symbol(): Attribute
{
Expand Down
12 changes: 12 additions & 0 deletions src/Models/Shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public function shippable(): MorphTo

/**
* Get the driver attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function driver(): Attribute
{
Expand All @@ -119,6 +121,8 @@ protected function driver(): Attribute

/**
* Get the total attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<float, never>
*/
protected function total(): Attribute
{
Expand All @@ -131,6 +135,8 @@ protected function total(): Attribute

/**
* Get the formatted total attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function formattedTotal(): Attribute
{
Expand All @@ -143,6 +149,8 @@ protected function formattedTotal(): Attribute

/**
* Get the subtotal attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<float, never>
*/
protected function subtotal(): Attribute
{
Expand All @@ -155,6 +163,8 @@ protected function subtotal(): Attribute

/**
* Get the formatted subtotal attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function formattedSubtotal(): Attribute
{
Expand All @@ -167,6 +177,8 @@ protected function formattedSubtotal(): Attribute

/**
* Get the name of the shipping method.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function driverName(): Attribute
{
Expand Down
4 changes: 4 additions & 0 deletions src/Models/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public function order(): BelongsTo

/**
* Get the name of the gateway driver.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string|null, never>
*/
protected function driverName(): Attribute
{
Expand All @@ -115,6 +117,8 @@ protected function driverName(): Attribute

/**
* Get the URL of the transaction.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string|null, never>
*/
protected function url(): Attribute
{
Expand Down
2 changes: 2 additions & 0 deletions src/Models/Variant.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public function product(): BelongsTo

/**
* Get the alias attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string|null, never>
*/
protected function alias(): Attribute
{
Expand Down
4 changes: 4 additions & 0 deletions src/Traits/HasPrices.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public function prices(): Prices

/**
* Get the price attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<float|null, never>
*/
protected function price(): Attribute
{
Expand All @@ -34,6 +36,8 @@ protected function price(): Attribute

/**
* Get the formatted price attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string|null, never>
*/
protected function formattedPrice(): Attribute
{
Expand Down
2 changes: 2 additions & 0 deletions src/Traits/InteractsWithDiscounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ trait InteractsWithDiscounts
{
/**
* Get the formatted discount attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function formattedDiscount(): Attribute
{
Expand Down
20 changes: 20 additions & 0 deletions src/Traits/InteractsWithItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public function shipping(): MorphOne

/**
* Get the currency attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function currency(): Attribute
{
Expand All @@ -74,6 +76,8 @@ protected function currency(): Attribute

/**
* Get the line items attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<\Illuminate\Support\Collection, never>
*/
protected function lineItems(): Attribute
{
Expand All @@ -86,6 +90,8 @@ protected function lineItems(): Attribute

/**
* Get the fees attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<\Illuminate\Support\Collection, never>
*/
protected function fees(): Attribute
{
Expand All @@ -98,6 +104,8 @@ protected function fees(): Attribute

/**
* Get the taxables attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<\Illuminate\Support\Collection, never>
*/
protected function taxables(): Attribute
{
Expand All @@ -112,6 +120,8 @@ protected function taxables(): Attribute

/**
* Get the total attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<float, never>
*/
protected function total(): Attribute
{
Expand All @@ -124,6 +134,8 @@ protected function total(): Attribute

/**
* Get the formatted total attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function formattedTotal(): Attribute
{
Expand All @@ -136,6 +148,8 @@ protected function formattedTotal(): Attribute

/**
* Get the subtotal attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<float, never>
*/
protected function subtotal(): Attribute
{
Expand All @@ -148,6 +162,8 @@ protected function subtotal(): Attribute

/**
* Get the formatted subtotal attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function formattedSubtotal(): Attribute
{
Expand All @@ -160,6 +176,8 @@ protected function formattedSubtotal(): Attribute

/**
* Get the tax attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<float, never>
*/
protected function tax(): Attribute
{
Expand All @@ -172,6 +190,8 @@ protected function tax(): Attribute

/**
* Get the formatted tax attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function formattedTax(): Attribute
{
Expand Down
2 changes: 2 additions & 0 deletions src/Traits/InteractsWithTaxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ trait InteractsWithTaxes
{
/**
* Get the formatted tax attribute.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never>
*/
protected function formattedTax(): Attribute
{
Expand Down

0 comments on commit 3bd2adb

Please sign in to comment.