From 2dbedef2f13f90f3433769752a2c548f28ec7042 Mon Sep 17 00:00:00 2001 From: Glenn Jacobs Date: Mon, 7 Aug 2023 11:32:27 +0100 Subject: [PATCH] Laravel Pint Improvements (#1182) Laravel Pint was causing issues as when a new version was released our codebase suddenly didn't conform. This update locks the version of Pint and also only checks changed files. --- .github/workflows/laravel-pint-code-style.yml | 18 +++++++++--------- .../src/Actions/Carts/GetExistingCartLine.php | 2 +- packages/core/src/Models/Cart.php | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/laravel-pint-code-style.yml b/.github/workflows/laravel-pint-code-style.yml index 8c9a380486..b834845764 100644 --- a/.github/workflows/laravel-pint-code-style.yml +++ b/.github/workflows/laravel-pint-code-style.yml @@ -4,13 +4,13 @@ on: jobs: Test: runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress - - - name: Check code style - run: ./vendor/bin/pint --test --preset laravel + - uses: actions/checkout@v1 + - name: "laravel-pint" + uses: aglipanci/laravel-pint-action@2.0.0 + with: + preset: laravel + verboseMode: true + testMode: true + pintVersion: 1.10.5 + onlyDirty: true diff --git a/packages/core/src/Actions/Carts/GetExistingCartLine.php b/packages/core/src/Actions/Carts/GetExistingCartLine.php index c71b9a2be5..ceb5d96198 100644 --- a/packages/core/src/Actions/Carts/GetExistingCartLine.php +++ b/packages/core/src/Actions/Carts/GetExistingCartLine.php @@ -17,7 +17,7 @@ public function execute( Cart $cart, Purchasable $purchasable, array $meta = [] - ): CartLine|null { + ): ?CartLine { // Get all possible cart lines $lines = $cart->lines() ->wherePurchasableType( diff --git a/packages/core/src/Models/Cart.php b/packages/core/src/Models/Cart.php index 9459382e71..f36e4cbfb6 100644 --- a/packages/core/src/Models/Cart.php +++ b/packages/core/src/Models/Cart.php @@ -556,7 +556,7 @@ public function setShippingOption(ShippingOption $option, $refresh = true): Cart /** * Get the shipping option for the cart */ - public function getShippingOption(): ShippingOption|null + public function getShippingOption(): ?ShippingOption { return ShippingManifest::getShippingOption($this); }