diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml deleted file mode 100644 index 2c6185e..0000000 --- a/.github/workflows/phpstan.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: PHPStan - -on: - push: - paths: - - '**.php' - - 'phpstan.neon.dist' - -jobs: - phpstan: - name: phpstan - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - coverage: none - - - name: Install composer dependencies - uses: ramsey/composer-install@v4 - - - name: Run PHPStan - run: ./vendor/bin/phpstan --error-format=github diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..6bd498a --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,65 @@ +name: tests + +on: + push: + branches: [main] + paths: + - '**.php' + - 'composer.json' + - 'composer.lock' + - 'phpunit.xml.dist' + - 'phpstan.neon.dist' + - 'phpstan-baseline.neon' + - '.github/workflows/run-tests.yml' + pull_request: + paths: + - '**.php' + - 'composer.json' + - 'composer.lock' + - 'phpunit.xml.dist' + - 'phpstan.neon.dist' + - 'phpstan-baseline.neon' + - '.github/workflows/run-tests.yml' + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: ['8.2', '8.3', '8.4'] + laravel: ['11.*', '12.*', '13.*'] + stability: [prefer-stable] + include: + - laravel: '11.*' + testbench: '9.*' + - laravel: '12.*' + testbench: '10.*' + - laravel: '13.*' + testbench: '11.*' + exclude: + - laravel: '13.*' + php: '8.2' + + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} + + steps: + - uses: actions/checkout@v6 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, bcmath, intl, fileinfo + coverage: none + + - name: Install dependencies + run: | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --dev --no-interaction --no-update + composer update --${{ matrix.stability }} --prefer-dist --no-interaction + + - name: Run tests + run: vendor/bin/pest + + - name: Run PHPStan + run: vendor/bin/phpstan analyse --error-format=github diff --git a/composer.json b/composer.json index 98cfdaf..6474a8d 100644 --- a/composer.json +++ b/composer.json @@ -25,19 +25,19 @@ "filament/tables": "^4.0|^5.0", "filament/infolists": "^4.0|^5.0", "spatie/laravel-package-tools": "^1.15.0", - "illuminate/contracts": "^11.28|^12.0" + "illuminate/contracts": "^11.28|^12.0|^13.0" }, "require-dev": { "laravel/pint": "^1.0", - "nunomaduro/collision": "^7.9", - "nunomaduro/larastan": "^2.0.1", - "orchestra/testbench": "^8.0", - "pestphp/pest": "^2.0", - "pestphp/pest-plugin-arch": "^2.0", - "pestphp/pest-plugin-laravel": "^2.0", + "nunomaduro/collision": "^8.0", + "larastan/larastan": "^3.0", + "orchestra/testbench": "^9.0|^10.0|^11.0", + "pestphp/pest": "^3.0|^4.0", + "pestphp/pest-plugin-arch": "^3.0|^4.0", + "pestphp/pest-plugin-laravel": "^3.0|^4.0", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", "spatie/laravel-ray": "^1.26" }, "autoload": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 9914a5e..a89f28c 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -8,5 +8,4 @@ parameters: tmpDir: build/phpstan checkOctaneCompatibility: true checkModelProperties: true - checkMissingIterableValueType: false diff --git a/phpunit.xml.dist b/phpunit.xml.dist index aaa4d82..3ce399f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -20,13 +20,6 @@ tests - - - - - - - diff --git a/src/SimpleLightBoxPlugin.php b/src/SimpleLightBoxPlugin.php index 456388c..c6f7076 100644 --- a/src/SimpleLightBoxPlugin.php +++ b/src/SimpleLightBoxPlugin.php @@ -29,7 +29,7 @@ public function boot(Panel $panel): void $url = $livewire->evaluate($url); } - if (! is_string($url) || is_null($url) || empty($url)) { + if (! is_string($url) || empty($url)) { $url = null; } @@ -37,12 +37,11 @@ public function boot(Panel $panel): void }; ImageColumn::macro('simpleLightbox', macro: function ($url = null, $defaultDisplayUrl = true) use ($ensureLightBoxUrl) { - + /** @var ImageColumn $this */ // @phpstan-ignore varTag.nativeType (Macroable rebinds $this to the target class at runtime) if ($defaultDisplayUrl) { $this->defaultImageUrl($url); } - /** @phpstan-ignore-next-line */ return $this ->openUrlInNewTab() ->action(fn () => null) // override default action for table row @@ -51,25 +50,23 @@ public function boot(Panel $panel): void }); ImageEntry::macro('simpleLightbox', function ($url = null, $defaultDisplayUrl = true) use ($ensureLightBoxUrl) { - + /** @var ImageEntry $this */ // @phpstan-ignore varTag.nativeType (Macroable rebinds $this to the target class at runtime) if ($defaultDisplayUrl) { $this->defaultImageUrl($url); } - /** @phpstan-ignore-next-line */ return $this ->openUrlInNewTab() ->extraAttributes(fn () => ['x-on:click' => 'SimpleLightBox.open(event, \'' . $ensureLightBoxUrl($url, $this) . '\')'], true) - ->extraImgAttributes(['class' => 'simple-light-box-img-indicator'], true); + ->extraImgAttributes(['class' => 'simple-light-box-img-indicator']); }); TextColumn::macro('simpleLightbox', function ($url = null, $defaultDisplayUrl = true) use ($ensureLightBoxUrl) { - + /** @var TextColumn $this */ // @phpstan-ignore varTag.nativeType (Macroable rebinds $this to the target class at runtime) if ($defaultDisplayUrl) { $this->default($url); } - /** @phpstan-ignore-next-line */ return $this ->openUrlInNewTab() ->url($url) @@ -77,12 +74,11 @@ public function boot(Panel $panel): void }); TextEntry::macro('simpleLightbox', function ($url = null, $defaultDisplayUrl = true) { - + /** @var TextEntry $this */ // @phpstan-ignore varTag.nativeType (Macroable rebinds $this to the target class at runtime) if ($defaultDisplayUrl) { $this->default($url); } - /** @phpstan-ignore-next-line */ return $this ->openUrlInNewTab() // ->extraAttributes(array_merge($extraAttributes, ['x-on:click' => 'SimpleLightBox.open(event, \'' . $url . '\')'])); diff --git a/tests/TestCase.php b/tests/TestCase.php index 2d6a692..7601658 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -9,8 +9,6 @@ use Filament\Forms\FormsServiceProvider; use Filament\Infolists\InfolistsServiceProvider; use Filament\Notifications\NotificationsServiceProvider; -use Filament\SpatieLaravelSettingsPluginServiceProvider; -use Filament\SpatieLaravelTranslatablePluginServiceProvider; use Filament\Support\SupportServiceProvider; use Filament\Tables\TablesServiceProvider; use Filament\Widgets\WidgetsServiceProvider; @@ -43,8 +41,6 @@ protected function getPackageProviders($app) InfolistsServiceProvider::class, LivewireServiceProvider::class, NotificationsServiceProvider::class, - SpatieLaravelSettingsPluginServiceProvider::class, - SpatieLaravelTranslatablePluginServiceProvider::class, SupportServiceProvider::class, TablesServiceProvider::class, WidgetsServiceProvider::class,