From 3ee8284641e3315225ccc0e3b36afd1aff22f3cd Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Thu, 27 Feb 2025 22:00:14 +0000 Subject: [PATCH 1/5] Update for v12 support --- composer.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index bda267c29..5a730630b 100644 --- a/composer.json +++ b/composer.json @@ -23,21 +23,21 @@ } ], "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.1|^8.2|^8.3|^8.4", "blade-ui-kit/blade-heroicons": "^2.1", - "illuminate/contracts": "^10.0|^11.0", - "illuminate/support": "^10.0|^11.0", + "illuminate/contracts": "^10.0|^11.0|^12.0", + "illuminate/support": "^10.0|^11.0|^12.0", "livewire/livewire": "^3.0|dev-main" }, "require-dev": { "ext-sqlite3": "*", - "brianium/paratest": "^5.0|^6.0|^7.0|^8.0", + "brianium/paratest": "^5.0|^6.0|^7.0|^8.0|^9.0", "laravel/pint": "^1.10", "monolog/monolog": "*", - "nunomaduro/collision": "^6.0|^7.0|^8.0", - "larastan/larastan": "^2.6", - "orchestra/testbench": "^7.0|^8.0|^9.0", - "phpunit/phpunit": "^9.0|^10.0|^11.0" + "nunomaduro/collision": "^6.0|^7.0|^8.0|^9.0", + "larastan/larastan": "^2.6|^3.0", + "orchestra/testbench": "^7.0|^8.0|^9.0|^10.0", + "phpunit/phpunit": "^9.0|^10.0|^11.0|^12.0" }, "autoload": { "psr-4": { From 5731c09430b35c3f829f7f9815e8f0eebe88f651 Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Thu, 27 Feb 2025 22:16:13 +0000 Subject: [PATCH 2/5] Add L12 Tests --- .github/workflows/run-tests-pull.yml | 83 ++++++++++++++++++++++++++++ .github/workflows/run-tests.yml | 83 ++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+) diff --git a/.github/workflows/run-tests-pull.yml b/.github/workflows/run-tests-pull.yml index 1ea6334be..9bb81b655 100644 --- a/.github/workflows/run-tests-pull.yml +++ b/.github/workflows/run-tests-pull.yml @@ -172,3 +172,86 @@ jobs: - name: Run Visuals Tests run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Visuals Test Suite" --no-coverage + + test-laravel12: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + max-parallel: 2 + matrix: + os: [ubuntu-latest] + php: [8.2, 8.3, 8.4] + laravel: [12.*] + stability: [prefer-dist] + + name: PULL PHP-${{ matrix.php }} - Laravel-12 + env: + extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }} + extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, fileinfo, :psr + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup cache environment + id: extcache + uses: shivammathur/cache-extensions@v1 + with: + php-version: ${{ matrix.php }} + extensions: ${{ env.extensions }} + key: ${{ env.extensionKey }} + + - name: Cache extensions + uses: actions/cache@v4 + with: + path: ${{ steps.extcache.outputs.dir }} + key: ${{ matrix.os }}-${{ steps.extcache.outputs.key }} + restore-keys: ${{ matrix.os }}-${{ steps.extcache.outputs.key }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: ${{ env.extensions }} + tools: phpunit:latest + ini-values: memory_limit=512M + coverage: none + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Get composer cache directory + id: composer-cache + run: | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}-composer- + + - name: Add token + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + composer config github-oauth.github.com $GITHUB_TOKEN + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer require "laravel/framework:${{ matrix.laravel }}.*" --no-interaction --no-update + + - name: Update dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer update --${{ matrix.stability }} --no-interaction + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Run Unit Tests + run: php ./vendor/bin/paratest --testsuite "Laravel Livewire Tables Unit Test Suite" --no-coverage + + - name: Run Visuals Tests + run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Visuals Test Suite" --no-coverage diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 21161009c..3031420bf 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -174,3 +174,86 @@ jobs: - name: Run Visuals Tests run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Visuals Test Suite" --no-coverage + + test-laravel12: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + max-parallel: 2 + matrix: + os: [ubuntu-24.04] + php: [8.2, 8.3, 8.4] + laravel: [12.*] + stability: [prefer-dist] + + name: PHP-${{ matrix.php }} - Laravel-12 + env: + extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, fileinfo, :psr + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup cache environment + id: extcache + uses: shivammathur/cache-extensions@v1 + with: + php-version: ${{ matrix.php }} + extensions: ${{ env.extensions }} + key: ${{ env.extensionKey }} + + - name: Cache extensions + uses: actions/cache@v4 + with: + path: ${{ steps.extcache.outputs.dir }} + key: ${{ matrix.os }}-${{ steps.extcache.outputs.key }} + restore-keys: ${{ matrix.os }}-${{ steps.extcache.outputs.key }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: ${{ env.extensions }} + tools: phpunit:latest + ini-values: memory_limit=512M + coverage: none + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Get composer cache directory + id: composer-cache + run: | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer- + + - name: Add token + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + composer config github-oauth.github.com $GITHUB_TOKEN + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer require "laravel/framework:${{ matrix.laravel }}.*" --no-interaction --no-update + + - name: Update dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer update --${{ matrix.stability }} --no-interaction + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Run Unit Tests + run: php ./vendor/bin/paratest --testsuite "Laravel Livewire Tables Unit Test Suite" --no-coverage + + - name: Run Visuals Tests + run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Visuals Test Suite" --no-coverage From 0366b5d462b8d05a9b055080990aa4988690cb94 Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Thu, 27 Feb 2025 22:25:03 +0000 Subject: [PATCH 3/5] Fix for PHPStan Run --- .github/workflows/run-phpstan-pull.yml | 10 +++++----- .github/workflows/run-phpstan.yml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/run-phpstan-pull.yml b/.github/workflows/run-phpstan-pull.yml index 7426e4a7a..bacc60816 100644 --- a/.github/workflows/run-phpstan-pull.yml +++ b/.github/workflows/run-phpstan-pull.yml @@ -12,9 +12,9 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-24.04] - php: [8.3] - laravel: [11] + os: [ubuntu-latest] + php: [8.4] + laravel: [12] stability: [prefer-dist] name: PHPStan - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -77,10 +77,10 @@ jobs: - name: Update dependencies if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer update --${{ matrix.stability }} --no-interaction + run: composer update --${{ matrix.stability }} --no-interaction -W - name: Install PHPStan - run: composer require larastan/larastan:^2.0 --no-interaction + run: composer require larastan/larastan:^3.0 --no-interaction -W - uses: actions/cache@v4 with: diff --git a/.github/workflows/run-phpstan.yml b/.github/workflows/run-phpstan.yml index 5132a9479..e3069324c 100644 --- a/.github/workflows/run-phpstan.yml +++ b/.github/workflows/run-phpstan.yml @@ -15,9 +15,9 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-24.04] - php: [8.3] - laravel: [11] + os: [ubuntu-latest] + php: [8.4] + laravel: [12] stability: [prefer-dist] name: PHPStan - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -80,10 +80,10 @@ jobs: - name: Update dependencies if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer update --${{ matrix.stability }} --no-interaction + run: composer update --${{ matrix.stability }} --no-interaction -W - name: Install PHPStan - run: composer require larastan/larastan:^2.0 --dev --no-interaction + run: composer require larastan/larastan:^3.0 --dev --no-interaction -W - uses: actions/cache@v4 with: From 36516ad3f9fc388d0dddf398789930f4d030ba22 Mon Sep 17 00:00:00 2001 From: LRLJoe Date: Thu, 27 Feb 2025 22:43:08 +0000 Subject: [PATCH 4/5] update phpstan ignores --- composer.json | 2 +- phpstan-baseline.neon | 51 ++++++++++++++++++++++++++++++------------- phpstan.neon | 28 +++++++++++++++++++++++- 3 files changed, 64 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 5a730630b..5347085db 100644 --- a/composer.json +++ b/composer.json @@ -32,10 +32,10 @@ "require-dev": { "ext-sqlite3": "*", "brianium/paratest": "^5.0|^6.0|^7.0|^8.0|^9.0", + "larastan/larastan": "^3.0", "laravel/pint": "^1.10", "monolog/monolog": "*", "nunomaduro/collision": "^6.0|^7.0|^8.0|^9.0", - "larastan/larastan": "^2.6|^3.0", "orchestra/testbench": "^7.0|^8.0|^9.0|^10.0", "phpunit/phpunit": "^9.0|^10.0|^11.0|^12.0" }, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 205fd1d59..d1ed59250 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,76 +1,97 @@ parameters: ignoreErrors: - - message: "#^Offset '1' on array\\, mixed\\>\\> in empty\\(\\) does not exist\\.$#" + message: '#^Offset ''1'' on array\ in empty\(\) does not exist\.$#' + identifier: empty.offset count: 1 path: src/DataTableComponent.php - - message: "#^Offset '99' on array\\, mixed\\>\\> in isset\\(\\) does not exist\\.$#" + message: '#^Offset ''99'' on array\ in isset\(\) does not exist\.$#' + identifier: isset.offset count: 1 path: src/DataTableComponent.php - - message: "#^Offset '99' on non\\-empty\\-array\\<1\\|string, array\\, mixed\\>\\> in isset\\(\\) does not exist\\.$#" + message: '#^Offset ''99'' on non\-empty\-array\<1\|string, list\> in isset\(\) does not exist\.$#' + identifier: isset.offset count: 1 path: src/DataTableComponent.php - - message: "#^Property Illuminate\\\\Database\\\\Query\\\\Builder\\:\\:\\$joins \\(array\\) on left side of \\?\\? is not nullable\\.$#" + message: '#^Parameter \#1 \$view of function view expects view\-string\|null, string given\.$#' + identifier: argument.type count: 1 path: src/DataTableComponent.php - - message: "#^Property Rappasoft\\\\LaravelLivewireTables\\\\DataTableComponent\\:\\:\\$model has no type specified\\.$#" + message: '#^Property Rappasoft\\LaravelLivewireTables\\DataTableComponent\:\:\$model has no type specified\.$#' + identifier: missingType.property count: 1 path: src/DataTableComponent.php - - message: "#^Unsafe usage of new static\\(\\)\\.$#" + message: '#^Parameter \#1 \$view of function view expects view\-string\|null, string given\.$#' + identifier: argument.type + count: 1 + path: src/View/Components/FilterPill.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static count: 1 path: src/Views/Action.php - - message: "#^Unsafe usage of new static\\(\\)\\.$#" + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static count: 1 path: src/Views/Column.php - - message: "#^Unsafe usage of new static\\(\\)\\.$#" + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static count: 1 path: src/Views/Filter.php - - message: "#^Parameter \\#1 \\$callback of method Illuminate\\\\Support\\\\Collection\\\\:\\:filter\\(\\) expects \\(callable\\(string, int\\)\\: bool\\)\\|null, Closure\\(mixed\\)\\: int\\<0, max\\> given\\.$#" + message: '#^Parameter \#1 \$callback of method Illuminate\\Support\\Collection\\:\:filter\(\) expects \(callable\(string, int\)\: bool\)\|null, Closure\(mixed\)\: int\<0, max\> given\.$#' + identifier: argument.type count: 1 path: src/Views/Filters/MultiSelectDropdownFilter.php - - message: "#^Unable to resolve the template type TMapWithKeysKey in call to method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:mapWithKeys\\(\\)$#" + message: '#^Unable to resolve the template type TMapWithKeysKey in call to method Illuminate\\Support\\Collection\<\(int\|string\),mixed\>\:\:mapWithKeys\(\)$#' + identifier: argument.templateType count: 1 path: src/Views/Filters/MultiSelectDropdownFilter.php - - message: "#^Unable to resolve the template type TMapWithKeysValue in call to method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:mapWithKeys\\(\\)$#" + message: '#^Unable to resolve the template type TMapWithKeysValue in call to method Illuminate\\Support\\Collection\<\(int\|string\),mixed\>\:\:mapWithKeys\(\)$#' + identifier: argument.templateType count: 1 path: src/Views/Filters/MultiSelectDropdownFilter.php - - message: "#^Parameter \\#1 \\$callback of method Illuminate\\\\Support\\\\Collection\\\\:\\:filter\\(\\) expects \\(callable\\(string, int\\)\\: bool\\)\\|null, Closure\\(mixed\\)\\: int\\<0, max\\> given\\.$#" + message: '#^Parameter \#1 \$callback of method Illuminate\\Support\\Collection\\:\:filter\(\) expects \(callable\(string, int\)\: bool\)\|null, Closure\(mixed\)\: int\<0, max\> given\.$#' + identifier: argument.type count: 1 path: src/Views/Filters/MultiSelectFilter.php - - message: "#^Parameter \\#1 \\$callback of method Illuminate\\\\Support\\\\Collection\\\\:\\:filter\\(\\) expects \\(callable\\(string, int\\)\\: bool\\)\\|null, Closure\\(mixed\\)\\: int\\<0, max\\> given\\.$#" + message: '#^Parameter \#1 \$callback of method Illuminate\\Support\\Collection\\:\:filter\(\) expects \(callable\(string, int\)\: bool\)\|null, Closure\(mixed\)\: int\<0, max\> given\.$#' + identifier: argument.type count: 1 path: src/Views/Filters/NumberRangeFilter.php - - message: "#^Unable to resolve the template type TMapWithKeysKey in call to method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:mapWithKeys\\(\\)$#" + message: '#^Unable to resolve the template type TMapWithKeysKey in call to method Illuminate\\Support\\Collection\<\(int\|string\),mixed\>\:\:mapWithKeys\(\)$#' + identifier: argument.templateType count: 1 path: src/Views/Filters/SelectFilter.php - - message: "#^Unable to resolve the template type TMapWithKeysValue in call to method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:mapWithKeys\\(\\)$#" + message: '#^Unable to resolve the template type TMapWithKeysValue in call to method Illuminate\\Support\\Collection\<\(int\|string\),mixed\>\:\:mapWithKeys\(\)$#' + identifier: argument.templateType count: 1 path: src/Views/Filters/SelectFilter.php diff --git a/phpstan.neon b/phpstan.neon index 6861405e1..30182f587 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -14,4 +14,30 @@ parameters: reportUnmatchedIgnoredErrors: false ignoreErrors: - identifier: missingType.generics - - identifier: missingType.iterableValue \ No newline at end of file + - identifier: missingType.iterableValue + - identifier: trait.unused + - identifier: deadCode.unreachable + - identifier: booleanNot.alwaysTrue + paths: + - src/Views/Columns/Traits/HasDataTableComponent.php + - identifier: notIdentical.alwaysTrue + paths: + - src/Traits/Filters/Helpers/FilterPillsHelpers.php + - src/Traits/Helpers/CustomisationsHelpers.php + - src/Traits/Helpers/QueryHelpers.php + - src/Views/Columns/Traits/HasSlot.php + - src/Views/Columns/Traits/Helpers/ArrayColumnHelpers.php + - identifier: instanceof.alwaysTrue + paths: + - src/Views/Columns/Traits/HasFooter.php + - src/Views/Columns/Traits/HasSecondaryHeader.php + - identifier: function.alreadyNarrowedType + paths: + - src/Views/Columns/Traits/Helpers/ArrayColumnHelpers.php + - src/Features/AutoInjectRappasoftAssets.php + - src/Traits/WithBulkActions.php + - src/Views/Actions/Traits/HasActionAttributes.php + - src/Views/Filters/MultiSelectDropdownFilter.php + - src/Views/Filters/Traits/HasOptions.php + - src/Views/Traits/Core/HasTheme.php + - src/Views/Traits/Core/HasView.php From 92f5ea01caecf8d847a2bf76356718f7dbbbb248 Mon Sep 17 00:00:00 2001 From: LRLJoe Date: Thu, 27 Feb 2025 22:46:41 +0000 Subject: [PATCH 5/5] Restore larastan 2.x for pre-11 --- .github/workflows/run-tests-pull.yml | 2 +- .github/workflows/run-tests.yml | 2 +- composer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests-pull.yml b/.github/workflows/run-tests-pull.yml index 9bb81b655..257e1d43d 100644 --- a/.github/workflows/run-tests-pull.yml +++ b/.github/workflows/run-tests-pull.yml @@ -14,7 +14,7 @@ jobs: max-parallel: 2 matrix: os: [ubuntu-latest] - php: [8.2, 8.3, 8.4] + php: [8.2, 8.3] laravel: [10.*] stability: [prefer-dist] diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3031420bf..70fb43bd8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -16,7 +16,7 @@ jobs: max-parallel: 2 matrix: os: [ubuntu-24.04] - php: [8.2, 8.3, 8.4] + php: [8.2, 8.3] laravel: [10.*] stability: [prefer-dist] diff --git a/composer.json b/composer.json index 5347085db..bd58755ef 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "require-dev": { "ext-sqlite3": "*", "brianium/paratest": "^5.0|^6.0|^7.0|^8.0|^9.0", - "larastan/larastan": "^3.0", + "larastan/larastan": "^2.6|^3.0", "laravel/pint": "^1.10", "monolog/monolog": "*", "nunomaduro/collision": "^6.0|^7.0|^8.0|^9.0",