diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e5f2e57..76cf455 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: true matrix: - php: [ 8.3, 8.2] + php: [ 8.3, 8.2 ] laravel: [ 10.* ] dependency-version: [ prefer-stable ] include: @@ -35,7 +35,7 @@ jobs: - name: Install dependencies run: | composer config "http-basic.nova.laravel.com" "${{ secrets.NOVA_USERNAME }}" "${{ secrets.NOVA_4_LICENSE_KEY }}" - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench-core:${{ matrix.testbench }}" --no-interaction --no-update composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction env: COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} @@ -47,14 +47,14 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 - name: Cache yarn dependencies uses: actions/cache@v4 id: npm-node_modules-cache with: path: node_modules - key: npm-${{ hashFiles('package.json') }}-node-20 + key: npm-${{ hashFiles('package.json') }}-node-22 - name: Compile assets run: npm install && npm run nova:install && npm run prod diff --git a/composer.json b/composer.json index bc11c91..c5b7c62 100644 --- a/composer.json +++ b/composer.json @@ -11,11 +11,11 @@ "require": { "php": "^8.1", "ext-json": "*", - "laravel/nova": "^4.20" + "laravel/nova": "^4.20 || ^5.0" }, "require-dev": { "interaction-design-foundation/coding-standard": "^0.3.0", - "orchestra/testbench": "^9.0", + "orchestra/testbench-core": "^8.22 || ^v9.7", "phpunit/phpunit": "^10.5 || ^11.0", "vimeo/psalm": "^5.22" }, @@ -59,6 +59,7 @@ "cs:check": "phpcs -p -s --colors --report-full --report-summary", "cs:fix": "phpcbf -p --colors", "psalm": "vendor/bin/psalm", + "sa": "@psalm", "test": "phpunit --colors=always" } } diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..c1c2595 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + ./tests* + + + + 1 + + + + src + tests + diff --git a/src/Unlayer.php b/src/Unlayer.php index 18b533b..513275c 100644 --- a/src/Unlayer.php +++ b/src/Unlayer.php @@ -16,6 +16,7 @@ class Unlayer extends Field { use SupportsDependentFields; + public const MODE_EMAIL = 'email'; public const MODE_WEB = 'web'; @@ -33,7 +34,7 @@ class Unlayer extends Field /** * A function to call on filling Model attributes from Request - * @var null|callable(\Laravel\Nova\Http\Requests\NovaRequest, string, \Illuminate\Database\Eloquent\Model, string):void $callback + * @var (callable(\Laravel\Nova\Http\Requests\NovaRequest, string, \Illuminate\Database\Eloquent\Model, string): void)|null $callback */ public $savingCallback; @@ -59,7 +60,7 @@ final public function config(array | callable $config): static ]); } - /** @param null|callable(\Laravel\Nova\Http\Requests\NovaRequest, string, \Illuminate\Database\Eloquent\Model, string):void $callback */ + /** @param (callable(\Laravel\Nova\Http\Requests\NovaRequest, string, \Illuminate\Database\Eloquent\Model, string): void)|null $callback */ final public function savingCallback(?callable $callback): static { $this->savingCallback = $callback; diff --git a/tests/UnlayerTest.php b/tests/UnlayerTest.php index 13972b5..17292a1 100644 --- a/tests/UnlayerTest.php +++ b/tests/UnlayerTest.php @@ -15,7 +15,7 @@ public function it_resolves_callback_to_html_code(): void { $field = new Unlayer('any_name'); - $field->html(static fn (): string => '

Hello!

'); + $field->html(static fn(): string => '

Hello!

'); $this->assertSame('

Hello!

', $field->meta()['html'] ?? null); }