Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions .github/workflows/phpstan.yml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ parameters:
tmpDir: build/phpstan
checkOctaneCompatibility: true
checkModelProperties: true
checkMissingIterableValueType: false

7 changes: 0 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
Expand Down
16 changes: 6 additions & 10 deletions src/SimpleLightBoxPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,19 @@ 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;
}

return $url;
};

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
Expand All @@ -51,38 +50,35 @@ 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)
->extraAttributes(fn () => ['x-on:click' => 'SimpleLightBox.open(event, \'' . $ensureLightBoxUrl($url, $this) . '\')'], true);
});

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 . '\')']));
Expand Down
4 changes: 0 additions & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -43,8 +41,6 @@ protected function getPackageProviders($app)
InfolistsServiceProvider::class,
LivewireServiceProvider::class,
NotificationsServiceProvider::class,
SpatieLaravelSettingsPluginServiceProvider::class,
SpatieLaravelTranslatablePluginServiceProvider::class,
SupportServiceProvider::class,
TablesServiceProvider::class,
WidgetsServiceProvider::class,
Expand Down