From bc58dfa18f6b181b301f1d9428ffb08a8b1eda32 Mon Sep 17 00:00:00 2001 From: Glenn Jacobs Date: Mon, 18 Sep 2023 08:28:42 +0100 Subject: [PATCH] Upgrade Laravel Pint (#1253) --- .github/workflows/laravel-pint-code-style.yml | 2 +- composer.json | 2 +- .../Livewire/Components/ActivityLogFeed.php | 2 +- .../Authentication/PasswordReset.php | 2 +- .../Livewire/Components/Brands/BrandShow.php | 6 +++--- .../Collections/CollectionGroupShow.php | 2 +- .../Components/Collections/CollectionShow.php | 6 +++--- .../Components/Collections/CollectionTree.php | 2 +- .../Components/Customers/CustomerShow.php | 2 +- .../Components/Discounts/AbstractDiscount.php | 4 ++-- .../Livewire/Components/Orders/OrderShow.php | 2 +- .../ProductOptions/OptionValueCreateModal.php | 2 +- .../Components/Products/AbstractProduct.php | 18 ++++++++--------- .../ProductTypes/AbstractProductType.php | 2 +- .../Products/Variants/VariantShow.php | 14 ++++++------- .../Settings/Attributes/AttributeEdit.php | 2 +- .../Attributes/AttributeGroupEdit.php | 2 +- .../Settings/Product/Options/OptionEdit.php | 2 +- .../Product/Options/OptionValueEdit.php | 2 +- .../Settings/Taxes/AbstractTaxZone.php | 2 +- .../Settings/Taxes/TaxClassesIndex.php | 2 +- .../admin/src/Http/Livewire/Dashboard.php | 2 +- packages/admin/src/Menu/MenuRegistry.php | 1 - packages/admin/src/Models/Staff.php | 2 +- packages/admin/tests/Stubs/User.php | 2 +- packages/core/composer.json | 2 +- ..._100013_add_attributes_to_brands_table.php | 1 - packages/core/src/Base/TaxDriver.php | 6 ------ packages/core/src/DiscountTypes/AmountOff.php | 2 +- .../core/src/FieldTypes/TranslatedText.php | 2 +- packages/core/src/Models/Attribute.php | 2 +- packages/core/src/Models/AttributeGroup.php | 2 +- packages/core/src/Models/Brand.php | 11 +++++----- packages/core/src/Models/Cart.php | 4 ++-- packages/core/src/Models/CartAddress.php | 4 ++-- packages/core/src/Models/CartLine.php | 4 ++-- packages/core/src/Models/Channel.php | 6 +++--- packages/core/src/Models/Collection.php | 10 +++++----- packages/core/src/Models/Currency.php | 4 ++-- packages/core/src/Models/Customer.php | 2 +- packages/core/src/Models/CustomerGroup.php | 2 +- packages/core/src/Models/Discount.php | 8 ++++---- packages/core/src/Models/Language.php | 2 +- packages/core/src/Models/Order.php | 4 ++-- packages/core/src/Models/OrderAddress.php | 4 ++-- packages/core/src/Models/OrderLine.php | 2 +- packages/core/src/Models/Product.php | 12 +++++------ packages/core/src/Models/ProductOption.php | 2 +- .../core/src/Models/ProductOptionValue.php | 2 +- packages/core/src/Models/ProductVariant.php | 8 +++----- packages/core/src/Models/TaxClass.php | 2 +- packages/core/src/Models/TaxZone.php | 2 +- packages/core/src/Models/Transaction.php | 2 +- packages/core/src/Utils/Arr.php | 4 ++-- packages/core/tests/Stubs/User.php | 4 +--- .../core/tests/Unit/DataTypes/PriceTest.php | 2 +- .../tests/Unit/DiscountTypes/BuyXGetYTest.php | 20 +++++++++---------- .../src/Components/Actions/Action.php | 4 ++-- .../src/Components/Columns/BaseColumn.php | 6 +++--- .../src/Components/Filters/BaseFilter.php | 4 ++-- .../livewire-tables/src/Components/Table.php | 6 +++--- 61 files changed, 119 insertions(+), 132 deletions(-) diff --git a/.github/workflows/laravel-pint-code-style.yml b/.github/workflows/laravel-pint-code-style.yml index df1911a1c8..b948736a48 100644 --- a/.github/workflows/laravel-pint-code-style.yml +++ b/.github/workflows/laravel-pint-code-style.yml @@ -12,5 +12,5 @@ jobs: preset: laravel verboseMode: true testMode: true - pintVersion: 1.10.5 + pintVersion: 1.13.1 onlyDirty: true diff --git a/composer.json b/composer.json index 47f7a10809..c0b4353eb6 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "spatie/laravel-permission": "^5.10" }, "require-dev": { - "laravel/pint": "^1.1", + "laravel/pint": "1.13.1", "mockery/mockery": "^1.4.4", "orchestra/testbench": "^7.0|^8.0", "phpunit/phpunit": "^9.5", diff --git a/packages/admin/src/Http/Livewire/Components/ActivityLogFeed.php b/packages/admin/src/Http/Livewire/Components/ActivityLogFeed.php index cffa0c36ca..17266a5a7c 100644 --- a/packages/admin/src/Http/Livewire/Components/ActivityLogFeed.php +++ b/packages/admin/src/Http/Livewire/Components/ActivityLogFeed.php @@ -11,7 +11,7 @@ class ActivityLogFeed extends Component { - use WithPagination, Notifies; + use Notifies, WithPagination; /** * The log subject to get activity for. diff --git a/packages/admin/src/Http/Livewire/Components/Authentication/PasswordReset.php b/packages/admin/src/Http/Livewire/Components/Authentication/PasswordReset.php index fe10240e6c..63f64880c0 100644 --- a/packages/admin/src/Http/Livewire/Components/Authentication/PasswordReset.php +++ b/packages/admin/src/Http/Livewire/Components/Authentication/PasswordReset.php @@ -17,8 +17,8 @@ class PasswordReset extends Component { use AuthorizesRequests; - use PerformsRedirects; use Notifies; + use PerformsRedirects; /** * The staff members email address. diff --git a/packages/admin/src/Http/Livewire/Components/Brands/BrandShow.php b/packages/admin/src/Http/Livewire/Components/Brands/BrandShow.php index e8aa66a305..b2d88f105b 100644 --- a/packages/admin/src/Http/Livewire/Components/Brands/BrandShow.php +++ b/packages/admin/src/Http/Livewire/Components/Brands/BrandShow.php @@ -16,13 +16,13 @@ class BrandShow extends Component { + use HasImages; use HasSlots; + use HasUrls; use Notifies; - use HasImages; + use WithAttributes; use WithFileUploads; - use HasUrls; use WithLanguages; - use WithAttributes; /** * The current brand we're showing. diff --git a/packages/admin/src/Http/Livewire/Components/Collections/CollectionGroupShow.php b/packages/admin/src/Http/Livewire/Components/Collections/CollectionGroupShow.php index 301fb2f104..1d44c21c7f 100644 --- a/packages/admin/src/Http/Livewire/Components/Collections/CollectionGroupShow.php +++ b/packages/admin/src/Http/Livewire/Components/Collections/CollectionGroupShow.php @@ -16,7 +16,7 @@ class CollectionGroupShow extends Component { - use Notifies, MapsCollectionTree; + use MapsCollectionTree, Notifies; /** * The current collection group. diff --git a/packages/admin/src/Http/Livewire/Components/Collections/CollectionShow.php b/packages/admin/src/Http/Livewire/Components/Collections/CollectionShow.php index 2b2fbfe50a..7ba8aea842 100644 --- a/packages/admin/src/Http/Livewire/Components/Collections/CollectionShow.php +++ b/packages/admin/src/Http/Livewire/Components/Collections/CollectionShow.php @@ -23,12 +23,12 @@ class CollectionShow extends Component { - use Notifies; use HasAvailability; - use WithAttributes; use HasImages; - use WithFileUploads; use HasUrls; + use Notifies; + use WithAttributes; + use WithFileUploads; use WithLanguages; /** diff --git a/packages/admin/src/Http/Livewire/Components/Collections/CollectionTree.php b/packages/admin/src/Http/Livewire/Components/Collections/CollectionTree.php index 49c34c71bb..b2be2513b6 100644 --- a/packages/admin/src/Http/Livewire/Components/Collections/CollectionTree.php +++ b/packages/admin/src/Http/Livewire/Components/Collections/CollectionTree.php @@ -10,7 +10,7 @@ class CollectionTree extends Component { - use Notifies, MapsCollectionTree; + use MapsCollectionTree, Notifies; /** * The nodes for the tree. diff --git a/packages/admin/src/Http/Livewire/Components/Customers/CustomerShow.php b/packages/admin/src/Http/Livewire/Components/Customers/CustomerShow.php index b24832fc25..be464dc213 100644 --- a/packages/admin/src/Http/Livewire/Components/Customers/CustomerShow.php +++ b/packages/admin/src/Http/Livewire/Components/Customers/CustomerShow.php @@ -29,9 +29,9 @@ class CustomerShow extends Component use HasSlots; use Notifies; use WithAttributes; - use WithPagination; use WithCountries; use WithLanguages; + use WithPagination; /** * The current customer in view. diff --git a/packages/admin/src/Http/Livewire/Components/Discounts/AbstractDiscount.php b/packages/admin/src/Http/Livewire/Components/Discounts/AbstractDiscount.php index bf916fc25e..5b257c5cc5 100644 --- a/packages/admin/src/Http/Livewire/Components/Discounts/AbstractDiscount.php +++ b/packages/admin/src/Http/Livewire/Components/Discounts/AbstractDiscount.php @@ -21,9 +21,9 @@ abstract class AbstractDiscount extends Component { - use WithLanguages; - use Notifies; use HasAvailability; + use Notifies; + use WithLanguages; /** * The instance of the discount. diff --git a/packages/admin/src/Http/Livewire/Components/Orders/OrderShow.php b/packages/admin/src/Http/Livewire/Components/Orders/OrderShow.php index e739bb41ac..e3881fbe02 100644 --- a/packages/admin/src/Http/Livewire/Components/Orders/OrderShow.php +++ b/packages/admin/src/Http/Livewire/Components/Orders/OrderShow.php @@ -14,7 +14,7 @@ class OrderShow extends Component { - use Notifies, WithCountries, HasSlots; + use HasSlots, Notifies, WithCountries; /** * The current order in view. diff --git a/packages/admin/src/Http/Livewire/Components/ProductOptions/OptionValueCreateModal.php b/packages/admin/src/Http/Livewire/Components/ProductOptions/OptionValueCreateModal.php index 094af3ef99..0b964bd2eb 100644 --- a/packages/admin/src/Http/Livewire/Components/ProductOptions/OptionValueCreateModal.php +++ b/packages/admin/src/Http/Livewire/Components/ProductOptions/OptionValueCreateModal.php @@ -9,8 +9,8 @@ class OptionValueCreateModal extends Component { - use WithLanguages; use Notifies; + use WithLanguages; /** * The parent product option for this new value. diff --git a/packages/admin/src/Http/Livewire/Components/Products/AbstractProduct.php b/packages/admin/src/Http/Livewire/Components/Products/AbstractProduct.php index 9db4ef1852..882fab6d18 100644 --- a/packages/admin/src/Http/Livewire/Components/Products/AbstractProduct.php +++ b/packages/admin/src/Http/Livewire/Components/Products/AbstractProduct.php @@ -32,19 +32,19 @@ abstract class AbstractProduct extends Component { - use Notifies; - use WithFileUploads; - use HasImages; + use CanExtendValidation; use HasAvailability; + use HasDimensions; + use HasImages; + use HasPrices; + use HasSlots; + use HasTags; + use HasUrls; + use Notifies; use SearchesProducts; use WithAttributes; + use WithFileUploads; use WithLanguages; - use HasPrices; - use HasDimensions; - use HasUrls; - use HasTags; - use HasSlots; - use CanExtendValidation; /** * The current product we are editing. diff --git a/packages/admin/src/Http/Livewire/Components/Products/ProductTypes/AbstractProductType.php b/packages/admin/src/Http/Livewire/Components/Products/ProductTypes/AbstractProductType.php index d3c44c10a4..1c666cabee 100644 --- a/packages/admin/src/Http/Livewire/Components/Products/ProductTypes/AbstractProductType.php +++ b/packages/admin/src/Http/Livewire/Components/Products/ProductTypes/AbstractProductType.php @@ -16,8 +16,8 @@ abstract class AbstractProductType extends Component { use Notifies; - use WithPagination; use WithLanguages; + use WithPagination; /** * The current view of attributes we're assigning. diff --git a/packages/admin/src/Http/Livewire/Components/Products/Variants/VariantShow.php b/packages/admin/src/Http/Livewire/Components/Products/Variants/VariantShow.php index 47d2035fbe..94bd36b409 100644 --- a/packages/admin/src/Http/Livewire/Components/Products/Variants/VariantShow.php +++ b/packages/admin/src/Http/Livewire/Components/Products/Variants/VariantShow.php @@ -27,15 +27,15 @@ class VariantShow extends Component { - use WithFileUploads; - use Notifies; - use HasPrices; - use WithLanguages; - use WithAttributes; + use CanExtendValidation; use HasDimensions; - use HasSlots; use HasImages; - use CanExtendValidation; + use HasPrices; + use HasSlots; + use Notifies; + use WithAttributes; + use WithFileUploads; + use WithLanguages; /** * Instance of the parent product. diff --git a/packages/admin/src/Http/Livewire/Components/Settings/Attributes/AttributeEdit.php b/packages/admin/src/Http/Livewire/Components/Settings/Attributes/AttributeEdit.php index eb5349416f..4d75ed11bd 100644 --- a/packages/admin/src/Http/Livewire/Components/Settings/Attributes/AttributeEdit.php +++ b/packages/admin/src/Http/Livewire/Components/Settings/Attributes/AttributeEdit.php @@ -13,8 +13,8 @@ class AttributeEdit extends Component { - use WithLanguages; use Notifies; + use WithLanguages; /** * The attribute group. diff --git a/packages/admin/src/Http/Livewire/Components/Settings/Attributes/AttributeGroupEdit.php b/packages/admin/src/Http/Livewire/Components/Settings/Attributes/AttributeGroupEdit.php index ef7053ac52..f81c612e06 100644 --- a/packages/admin/src/Http/Livewire/Components/Settings/Attributes/AttributeGroupEdit.php +++ b/packages/admin/src/Http/Livewire/Components/Settings/Attributes/AttributeGroupEdit.php @@ -10,8 +10,8 @@ class AttributeGroupEdit extends Component { - use WithLanguages; use Notifies; + use WithLanguages; /** * The type of attributable this is. diff --git a/packages/admin/src/Http/Livewire/Components/Settings/Product/Options/OptionEdit.php b/packages/admin/src/Http/Livewire/Components/Settings/Product/Options/OptionEdit.php index c5d6e58935..9cdf37e89b 100644 --- a/packages/admin/src/Http/Livewire/Components/Settings/Product/Options/OptionEdit.php +++ b/packages/admin/src/Http/Livewire/Components/Settings/Product/Options/OptionEdit.php @@ -11,8 +11,8 @@ class OptionEdit extends Component { - use WithLanguages; use Notifies; + use WithLanguages; /** * The option to edit. diff --git a/packages/admin/src/Http/Livewire/Components/Settings/Product/Options/OptionValueEdit.php b/packages/admin/src/Http/Livewire/Components/Settings/Product/Options/OptionValueEdit.php index f5f75ec7ec..ae1f5a9075 100644 --- a/packages/admin/src/Http/Livewire/Components/Settings/Product/Options/OptionValueEdit.php +++ b/packages/admin/src/Http/Livewire/Components/Settings/Product/Options/OptionValueEdit.php @@ -10,8 +10,8 @@ class OptionValueEdit extends Component { - use WithLanguages; use Notifies; + use WithLanguages; /** * The option instance. diff --git a/packages/admin/src/Http/Livewire/Components/Settings/Taxes/AbstractTaxZone.php b/packages/admin/src/Http/Livewire/Components/Settings/Taxes/AbstractTaxZone.php index 96c3666c42..a444905fc1 100644 --- a/packages/admin/src/Http/Livewire/Components/Settings/Taxes/AbstractTaxZone.php +++ b/packages/admin/src/Http/Livewire/Components/Settings/Taxes/AbstractTaxZone.php @@ -16,7 +16,7 @@ abstract class AbstractTaxZone extends Component { - use WithPagination, Notifies; + use Notifies, WithPagination; /** * The instance of the Tax Zone. diff --git a/packages/admin/src/Http/Livewire/Components/Settings/Taxes/TaxClassesIndex.php b/packages/admin/src/Http/Livewire/Components/Settings/Taxes/TaxClassesIndex.php index ca4fdb78e8..e5d8b7b088 100644 --- a/packages/admin/src/Http/Livewire/Components/Settings/Taxes/TaxClassesIndex.php +++ b/packages/admin/src/Http/Livewire/Components/Settings/Taxes/TaxClassesIndex.php @@ -10,7 +10,7 @@ class TaxClassesIndex extends Component { - use WithPagination, Notifies; + use Notifies, WithPagination; /** * The TaxClass to edit. diff --git a/packages/admin/src/Http/Livewire/Dashboard.php b/packages/admin/src/Http/Livewire/Dashboard.php index 1730c61238..6715d5dcbe 100644 --- a/packages/admin/src/Http/Livewire/Dashboard.php +++ b/packages/admin/src/Http/Livewire/Dashboard.php @@ -156,7 +156,7 @@ public function getTopSellingProductsProperty() now()->parse($this->to), ])->join($variantsTable, function ($join) use ($variantsTable, $orderLineTable) { $join->on("{$variantsTable}.id", '=', "{$orderLineTable}.purchasable_id") - ->where('purchasable_type', '=', ProductVariant::class); + ->where('purchasable_type', '=', ProductVariant::class); })->groupBy('purchasable_type', 'purchasable_id') ->orderBy('count', 'desc') ->take(2)->get(); diff --git a/packages/admin/src/Menu/MenuRegistry.php b/packages/admin/src/Menu/MenuRegistry.php index ad068ea4d8..8224a272e4 100644 --- a/packages/admin/src/Menu/MenuRegistry.php +++ b/packages/admin/src/Menu/MenuRegistry.php @@ -27,7 +27,6 @@ public function __construct() * then a new one will be added to the slots property and returned. * * @param string $handle - * @return \Lunar\Hub\Menu\MenuSlot */ public function slot($handle): MenuSlot { diff --git a/packages/admin/src/Models/Staff.php b/packages/admin/src/Models/Staff.php index 1ba4d64ad6..4cfc9546e8 100644 --- a/packages/admin/src/Models/Staff.php +++ b/packages/admin/src/Models/Staff.php @@ -12,9 +12,9 @@ class Staff extends Authenticatable { use HasFactory; + use HasRoles; use Notifiable; use SoftDeletes; - use HasRoles; /** * Return a new factory instance for the model. diff --git a/packages/admin/tests/Stubs/User.php b/packages/admin/tests/Stubs/User.php index 0305a6b055..d9962384db 100644 --- a/packages/admin/tests/Stubs/User.php +++ b/packages/admin/tests/Stubs/User.php @@ -10,8 +10,8 @@ class User extends Authenticatable { use HasFactory; - use Notifiable; use LunarUser; + use Notifiable; /** * The attributes that are mass assignable. diff --git a/packages/core/composer.json b/packages/core/composer.json index 0412e9bd0c..ac1e234cfa 100644 --- a/packages/core/composer.json +++ b/packages/core/composer.json @@ -51,6 +51,6 @@ }, "require-dev": { "orchestra/testbench": "^7.0|^8.0", - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "1.13.1" } } diff --git a/packages/core/database/migrations/2023_08_16_100013_add_attributes_to_brands_table.php b/packages/core/database/migrations/2023_08_16_100013_add_attributes_to_brands_table.php index 23279b036e..1e20a643a5 100644 --- a/packages/core/database/migrations/2023_08_16_100013_add_attributes_to_brands_table.php +++ b/packages/core/database/migrations/2023_08_16_100013_add_attributes_to_brands_table.php @@ -3,7 +3,6 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; use Lunar\Base\Migration; -use Lunar\Facades\DB; class AddAttributesToBrandsTable extends Migration { diff --git a/packages/core/src/Base/TaxDriver.php b/packages/core/src/Base/TaxDriver.php index 96ac2305dc..aa81dc732e 100644 --- a/packages/core/src/Base/TaxDriver.php +++ b/packages/core/src/Base/TaxDriver.php @@ -10,8 +10,6 @@ interface TaxDriver { /** * Set the shipping address. - * - * @param \Lunar\Base\Addressable|null $address */ public function setShippingAddress(Addressable $address = null): self; @@ -22,15 +20,11 @@ public function setCurrency(Currency $currency): self; /** * Set the billing address. - * - * @param \Lunar\Base\Addressable|null $address */ public function setBillingAddress(Addressable $address = null): self; /** * Set the purchasable item. - * - * @param \Lunar\Base\Purchasable $purchasable */ public function setPurchasable(Purchasable $purchasable): self; diff --git a/packages/core/src/DiscountTypes/AmountOff.php b/packages/core/src/DiscountTypes/AmountOff.php index 5bfbd29bf6..4b8d3ca866 100644 --- a/packages/core/src/DiscountTypes/AmountOff.php +++ b/packages/core/src/DiscountTypes/AmountOff.php @@ -127,7 +127,7 @@ private function applyFixedValue(array $values, Cart $cart): Cart ); if (! $affectedLines->first(function ($breakdownLine) use ($line) { - return $breakdownLine->line == $line; + return $breakdownLine->line == $line; })) { $affectedLines->push(new DiscountBreakdownLine( line: $line, diff --git a/packages/core/src/FieldTypes/TranslatedText.php b/packages/core/src/FieldTypes/TranslatedText.php index b89008f9a1..d366f1f812 100644 --- a/packages/core/src/FieldTypes/TranslatedText.php +++ b/packages/core/src/FieldTypes/TranslatedText.php @@ -68,7 +68,7 @@ public function setValue($value) $item = new Text($item); $value[$key] = $item; } - if ($item && (Text::class !== get_class($item))) { + if ($item && (get_class($item) !== Text::class)) { throw new FieldTypeException(self::class.' only supports '.Text::class.' field types.'); } } diff --git a/packages/core/src/Models/Attribute.php b/packages/core/src/Models/Attribute.php index 7cd3168601..1b0420eedf 100644 --- a/packages/core/src/Models/Attribute.php +++ b/packages/core/src/Models/Attribute.php @@ -36,8 +36,8 @@ class Attribute extends BaseModel { use HasFactory; - use HasTranslations; use HasMacros; + use HasTranslations; public static function boot() { diff --git a/packages/core/src/Models/AttributeGroup.php b/packages/core/src/Models/AttributeGroup.php index b13842c5a9..54ceab15cf 100644 --- a/packages/core/src/Models/AttributeGroup.php +++ b/packages/core/src/Models/AttributeGroup.php @@ -21,8 +21,8 @@ class AttributeGroup extends BaseModel { use HasFactory; - use HasTranslations; use HasMacros; + use HasTranslations; /** * Return a new factory instance for the model. diff --git a/packages/core/src/Models/Brand.php b/packages/core/src/Models/Brand.php index a253704439..d1aff03b85 100644 --- a/packages/core/src/Models/Brand.php +++ b/packages/core/src/Models/Brand.php @@ -14,7 +14,6 @@ use Lunar\Base\Traits\LogsActivity; use Lunar\Base\Traits\Searchable; use Lunar\Database\Factories\BrandFactory; -use Lunar\FieldTypes\TranslatedText; use Spatie\MediaLibrary\HasMedia as SpatieHasMedia; /** @@ -26,14 +25,14 @@ */ class Brand extends BaseModel implements SpatieHasMedia { - use HasFactory, + use HasAttributes, + HasFactory, + HasMacros, HasMedia, + HasTranslations, HasUrls, - Searchable, LogsActivity, - HasMacros, - HasAttributes, - HasTranslations; + Searchable; /** * {@inheritDoc} diff --git a/packages/core/src/Models/Cart.php b/packages/core/src/Models/Cart.php index f36e4cbfb6..a531ad6ece 100644 --- a/packages/core/src/Models/Cart.php +++ b/packages/core/src/Models/Cart.php @@ -53,10 +53,10 @@ */ class Cart extends BaseModel { + use CachesProperties; use HasFactory; - use LogsActivity; use HasMacros; - use CachesProperties; + use LogsActivity; /** * Array of cachable class properties. diff --git a/packages/core/src/Models/CartAddress.php b/packages/core/src/Models/CartAddress.php index f5ed4390b8..83c210b317 100644 --- a/packages/core/src/Models/CartAddress.php +++ b/packages/core/src/Models/CartAddress.php @@ -39,10 +39,10 @@ */ class CartAddress extends BaseModel implements Addressable { + use CachesProperties; use HasFactory; - use LogsActivity; use HasMacros; - use CachesProperties; + use LogsActivity; /** * Array of cachable class properties. diff --git a/packages/core/src/Models/CartLine.php b/packages/core/src/Models/CartLine.php index 28b03f12bc..eea2fb39a7 100644 --- a/packages/core/src/Models/CartLine.php +++ b/packages/core/src/Models/CartLine.php @@ -24,10 +24,10 @@ */ class CartLine extends BaseModel { + use CachesProperties; use HasFactory; - use LogsActivity; use HasMacros; - use CachesProperties; + use LogsActivity; /** * Array of cachable class properties. diff --git a/packages/core/src/Models/Channel.php b/packages/core/src/Models/Channel.php index b2499ceb35..996a9c82af 100644 --- a/packages/core/src/Models/Channel.php +++ b/packages/core/src/Models/Channel.php @@ -23,11 +23,11 @@ */ class Channel extends BaseModel { - use HasFactory; - use SoftDeletes; - use LogsActivity; use HasDefaultRecord; + use HasFactory; use HasMacros; + use LogsActivity; + use SoftDeletes; /** * Return a new factory instance for the model. diff --git a/packages/core/src/Models/Collection.php b/packages/core/src/Models/Collection.php index d0876e308c..7900f2bf61 100644 --- a/packages/core/src/Models/Collection.php +++ b/packages/core/src/Models/Collection.php @@ -33,14 +33,14 @@ */ class Collection extends BaseModel implements SpatieHasMedia { - use HasFactory, + use HasChannels, + HasCustomerGroups, + HasFactory, + HasMacros, HasMedia, - NodeTrait, HasTranslations, - HasChannels, HasUrls, - HasCustomerGroups, - HasMacros, + NodeTrait, Searchable { NodeTrait::usesSoftDelete insteadof Searchable; } diff --git a/packages/core/src/Models/Currency.php b/packages/core/src/Models/Currency.php index 9e597198ef..9a8cd3e646 100644 --- a/packages/core/src/Models/Currency.php +++ b/packages/core/src/Models/Currency.php @@ -23,10 +23,10 @@ */ class Currency extends BaseModel { - use HasFactory; - use LogsActivity; use HasDefaultRecord; + use HasFactory; use HasMacros; + use LogsActivity; /** * Define which attributes should be diff --git a/packages/core/src/Models/Customer.php b/packages/core/src/Models/Customer.php index 8a4ff19c97..5acbfafa23 100644 --- a/packages/core/src/Models/Customer.php +++ b/packages/core/src/Models/Customer.php @@ -30,10 +30,10 @@ class Customer extends BaseModel { use HasAttributes; use HasFactory; + use HasMacros; use HasPersonalDetails; use HasTranslations; use Searchable; - use HasMacros; /** * Define the guarded attributes. diff --git a/packages/core/src/Models/CustomerGroup.php b/packages/core/src/Models/CustomerGroup.php index 1f6dbe3850..5994b92899 100644 --- a/packages/core/src/Models/CustomerGroup.php +++ b/packages/core/src/Models/CustomerGroup.php @@ -18,8 +18,8 @@ */ class CustomerGroup extends BaseModel { - use HasFactory; use HasDefaultRecord; + use HasFactory; use HasMacros; /** diff --git a/packages/core/src/Models/Discount.php b/packages/core/src/Models/Discount.php index b37eba0d3a..146fd7548a 100644 --- a/packages/core/src/Models/Discount.php +++ b/packages/core/src/Models/Discount.php @@ -29,10 +29,10 @@ */ class Discount extends BaseModel { - use HasFactory, - HasTranslations, - HasChannels, - HasCustomerGroups; + use HasChannels, + HasCustomerGroups, + HasFactory, + HasTranslations; protected $guarded = []; diff --git a/packages/core/src/Models/Language.php b/packages/core/src/Models/Language.php index 3b6d6e6da8..5d0e9d2448 100644 --- a/packages/core/src/Models/Language.php +++ b/packages/core/src/Models/Language.php @@ -19,8 +19,8 @@ */ class Language extends BaseModel { - use HasFactory; use HasDefaultRecord; + use HasFactory; use HasMacros; /** diff --git a/packages/core/src/Models/Order.php b/packages/core/src/Models/Order.php index d290b1431b..b17de2d93b 100644 --- a/packages/core/src/Models/Order.php +++ b/packages/core/src/Models/Order.php @@ -43,10 +43,10 @@ class Order extends BaseModel { use HasFactory, - Searchable, + HasMacros, HasTags, LogsActivity, - HasMacros; + Searchable; /** * Define our base filterable attributes. diff --git a/packages/core/src/Models/OrderAddress.php b/packages/core/src/Models/OrderAddress.php index 81e3cc730d..4c94a49ced 100644 --- a/packages/core/src/Models/OrderAddress.php +++ b/packages/core/src/Models/OrderAddress.php @@ -37,9 +37,9 @@ class OrderAddress extends BaseModel implements Addressable { use HasFactory; - use LogsActivity; - use HasPersonalDetails; use HasMacros; + use HasPersonalDetails; + use LogsActivity; /** * Return a new factory instance for the model. diff --git a/packages/core/src/Models/OrderLine.php b/packages/core/src/Models/OrderLine.php index 17804133fc..ca8ba65176 100644 --- a/packages/core/src/Models/OrderLine.php +++ b/packages/core/src/Models/OrderLine.php @@ -35,9 +35,9 @@ */ class OrderLine extends BaseModel { - use LogsActivity; use HasFactory; use HasMacros; + use LogsActivity; /** * Return a new factory instance for the model. diff --git a/packages/core/src/Models/Product.php b/packages/core/src/Models/Product.php index 3e220bd62d..8ff5e753de 100644 --- a/packages/core/src/Models/Product.php +++ b/packages/core/src/Models/Product.php @@ -35,17 +35,17 @@ */ class Product extends BaseModel implements SpatieHasMedia { + use HasChannels; + use HasCustomerGroups; use HasFactory; + use HasMacros; use HasMedia; - use LogsActivity; - use HasChannels; - use HasTranslations; use HasTags; - use HasCustomerGroups; + use HasTranslations; use HasUrls; + use LogsActivity; use Searchable; use SoftDeletes; - use HasMacros; /** * Return a new factory instance for the model. @@ -173,7 +173,7 @@ public function dissociate($product, $type = null) { Dissociate::dispatch($this, $product, $type); } - + /** * Return the customer groups relationship. */ diff --git a/packages/core/src/Models/ProductOption.php b/packages/core/src/Models/ProductOption.php index 8719d98c16..d9462eba92 100644 --- a/packages/core/src/Models/ProductOption.php +++ b/packages/core/src/Models/ProductOption.php @@ -25,10 +25,10 @@ class ProductOption extends BaseModel implements SpatieHasMedia { use HasFactory; + use HasMacros; use HasMedia; use HasTranslations; use Searchable; - use HasMacros; /** * Define our base filterable attributes. diff --git a/packages/core/src/Models/ProductOptionValue.php b/packages/core/src/Models/ProductOptionValue.php index 44e0a4be27..cb450274c9 100644 --- a/packages/core/src/Models/ProductOptionValue.php +++ b/packages/core/src/Models/ProductOptionValue.php @@ -22,9 +22,9 @@ class ProductOptionValue extends BaseModel implements SpatieHasMedia { use HasFactory; + use HasMacros; use HasMedia; use HasTranslations; - use HasMacros; /** * Define which attributes should be cast. diff --git a/packages/core/src/Models/ProductVariant.php b/packages/core/src/Models/ProductVariant.php index afc2fb3050..53f16d66cb 100644 --- a/packages/core/src/Models/ProductVariant.php +++ b/packages/core/src/Models/ProductVariant.php @@ -47,12 +47,12 @@ */ class ProductVariant extends BaseModel implements Purchasable { + use HasDimensions; use HasFactory; + use HasMacros; use HasPrices; - use LogsActivity; - use HasDimensions; use HasTranslations; - use HasMacros; + use LogsActivity; /** * Define the guarded attributes. @@ -129,8 +129,6 @@ public function getUnitQuantity(): int /** * Return the tax class. - * - * @return \Lunar\Models\TaxClass */ public function getTaxClass(): TaxClass { diff --git a/packages/core/src/Models/TaxClass.php b/packages/core/src/Models/TaxClass.php index ccc76dd65e..5331adc650 100644 --- a/packages/core/src/Models/TaxClass.php +++ b/packages/core/src/Models/TaxClass.php @@ -17,8 +17,8 @@ */ class TaxClass extends BaseModel { - use HasFactory; use HasDefaultRecord; + use HasFactory; use HasMacros; public static function booted() diff --git a/packages/core/src/Models/TaxZone.php b/packages/core/src/Models/TaxZone.php index 91a788d4ef..0f653a7c99 100644 --- a/packages/core/src/Models/TaxZone.php +++ b/packages/core/src/Models/TaxZone.php @@ -20,8 +20,8 @@ */ class TaxZone extends BaseModel { - use HasFactory; use HasDefaultRecord; + use HasFactory; use HasMacros; /** diff --git a/packages/core/src/Models/Transaction.php b/packages/core/src/Models/Transaction.php index a93e12d5cd..6e3f03d22c 100644 --- a/packages/core/src/Models/Transaction.php +++ b/packages/core/src/Models/Transaction.php @@ -32,8 +32,8 @@ class Transaction extends BaseModel { use HasFactory; - use LogsActivity; use HasMacros; + use LogsActivity; /** * {@inheritDoc} diff --git a/packages/core/src/Utils/Arr.php b/packages/core/src/Utils/Arr.php index 51a20efed6..519087d4a7 100644 --- a/packages/core/src/Utils/Arr.php +++ b/packages/core/src/Utils/Arr.php @@ -17,11 +17,11 @@ public static function permutate(array $setTuples, $isRecursiveStep = false) { $countTuples = count($setTuples); - if (1 === $countTuples) { + if ($countTuples === 1) { return reset($setTuples); } - if (0 === $countTuples) { + if ($countTuples === 0) { return []; } diff --git a/packages/core/tests/Stubs/User.php b/packages/core/tests/Stubs/User.php index bd1eaba807..cb4546472b 100644 --- a/packages/core/tests/Stubs/User.php +++ b/packages/core/tests/Stubs/User.php @@ -9,8 +9,8 @@ class User extends Authenticatable { - use LunarUser; use HasFactory; + use LunarUser; use Notifiable; /** @@ -45,8 +45,6 @@ class User extends Authenticatable /** * Return a new factory instance for the model. - * - * @return \Lunar\Tests\Stubs\UserFactory */ protected static function newFactory(): UserFactory { diff --git a/packages/core/tests/Unit/DataTypes/PriceTest.php b/packages/core/tests/Unit/DataTypes/PriceTest.php index 031f043495..e03a971331 100644 --- a/packages/core/tests/Unit/DataTypes/PriceTest.php +++ b/packages/core/tests/Unit/DataTypes/PriceTest.php @@ -121,7 +121,7 @@ public function can_format_numbers_specifying_decimal_places() } /** @test */ - function can_format_numbers_specifying_decimal_places_with_currency_suffix() + public function can_format_numbers_specifying_decimal_places_with_currency_suffix() { $currency = Currency::factory()->create([ 'code' => 'SEK', diff --git a/packages/core/tests/Unit/DiscountTypes/BuyXGetYTest.php b/packages/core/tests/Unit/DiscountTypes/BuyXGetYTest.php index bbc112749e..d632c03e01 100644 --- a/packages/core/tests/Unit/DiscountTypes/BuyXGetYTest.php +++ b/packages/core/tests/Unit/DiscountTypes/BuyXGetYTest.php @@ -25,6 +25,7 @@ class BuyXGetYTest extends TestCase /** * @dataProvider provideRewardChecks + * * @test */ public function can_determine_correct_reward_qty($linesQuantity, $minQty, $rewardQty, $maxRewardQty, $expected) @@ -49,35 +50,35 @@ public function provideRewardChecks() 'linesQuantity' => 1, 'minQty' => 1, 'rewardQty' => 1, - 'maxRewardQty' => null, + 'maxRewardQty' => null, 'expected' => 1, ], [ 'linesQuantity' => 2, 'minQty' => 1, 'rewardQty' => 1, - 'maxRewardQty' => null, + 'maxRewardQty' => null, 'expected' => 2, ], [ 'linesQuantity' => 2, 'minQty' => 2, 'rewardQty' => 1, - 'maxRewardQty' => null, + 'maxRewardQty' => null, 'expected' => 1, ], [ 'linesQuantity' => 10, 'minQty' => 10, 'rewardQty' => 1, - 'maxRewardQty' => null, + 'maxRewardQty' => null, 'expected' => 1, ], [ 'linesQuantity' => 10, 'minQty' => 1, 'rewardQty' => 1, - 'maxRewardQty' => null, + 'maxRewardQty' => null, 'expected' => 10, ], [ @@ -98,28 +99,28 @@ public function provideRewardChecks() 'linesQuantity' => 0, 'minQty' => 1, 'rewardQty' => 1, - 'maxRewardQty' => null, + 'maxRewardQty' => null, 'expected' => 0, ], [ 'linesQuantity' => 4, 'minQty' => 5, 'rewardQty' => 3, - 'maxRewardQty' => null, + 'maxRewardQty' => null, 'expected' => 0, ], [ 'linesQuantity' => 5, 'minQty' => 5, 'rewardQty' => 3, - 'maxRewardQty' => null, + 'maxRewardQty' => null, 'expected' => 3, ], [ 'linesQuantity' => 10, 'minQty' => 5, 'rewardQty' => 3, - 'maxRewardQty' => null, + 'maxRewardQty' => null, 'expected' => 6, ], [ @@ -132,7 +133,6 @@ public function provideRewardChecks() ]; } - /** @test */ public function can_discount_eligible_product() { diff --git a/utils/livewire-tables/src/Components/Actions/Action.php b/utils/livewire-tables/src/Components/Actions/Action.php index 0a206c0af5..c1a482e74a 100644 --- a/utils/livewire-tables/src/Components/Actions/Action.php +++ b/utils/livewire-tables/src/Components/Actions/Action.php @@ -12,8 +12,8 @@ class Action extends Component implements Htmlable { - use HasLivewireComponent, - HasClosure, + use HasClosure, + HasLivewireComponent, HasViewComponent, HasViewProperties; diff --git a/utils/livewire-tables/src/Components/Columns/BaseColumn.php b/utils/livewire-tables/src/Components/Columns/BaseColumn.php index 802d5c5389..168baa2c0e 100644 --- a/utils/livewire-tables/src/Components/Columns/BaseColumn.php +++ b/utils/livewire-tables/src/Components/Columns/BaseColumn.php @@ -13,11 +13,11 @@ abstract class BaseColumn extends Component { - use HasLivewireComponent, - HasClosure, - HasViewComponent, + use HasClosure, HasEloquentRelationships, + HasLivewireComponent, HasTranslations, + HasViewComponent, HasViewProperties; /** diff --git a/utils/livewire-tables/src/Components/Filters/BaseFilter.php b/utils/livewire-tables/src/Components/Filters/BaseFilter.php index 0a528c54ff..eed58f6907 100644 --- a/utils/livewire-tables/src/Components/Filters/BaseFilter.php +++ b/utils/livewire-tables/src/Components/Filters/BaseFilter.php @@ -10,8 +10,8 @@ abstract class BaseFilter extends Component implements Htmlable { - use HasViewProperties, - HasTranslations; + use HasTranslations, + HasViewProperties; public $view = 'l-tables::filters.base'; diff --git a/utils/livewire-tables/src/Components/Table.php b/utils/livewire-tables/src/Components/Table.php index b92c5b84f6..3b2dbe83bc 100644 --- a/utils/livewire-tables/src/Components/Table.php +++ b/utils/livewire-tables/src/Components/Table.php @@ -11,9 +11,9 @@ class Table extends Component { - use WithPagination, - HasSavedSearches, - HasSortableColumns; + use HasSavedSearches, + HasSortableColumns, + WithPagination; /** * The binding to use when building out the table.