Skip to content

Commit

Permalink
Added analyse action
Browse files Browse the repository at this point in the history
  • Loading branch information
BobWez98 committed Jun 20, 2024
1 parent 8d5f7c0 commit 250d8f4
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 3 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: analyse

on: ['push', 'pull_request']

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.3]
laravel: [10.*, 11.*]
stability: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Analyse
run: composer analyse
11 changes: 10 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
"type": "package",
"require": {
"php": "^8.0|^8.1",
"laravel/framework": "*",
"laravel/framework": "^10.0|^11.0",
"statamic/cms": "^4.0"
},
"require-dev": {
"laravel/pint": "^1.7",
"larastan/larastan": "^2.5",
"phpstan/phpstan-mockery": "^1.1",
"orchestra/testbench": "^8.0|^9.0"
},
"autoload": {
"psr-4": {
"JustBetter\\GlideDirective\\": "src/"
Expand Down Expand Up @@ -41,5 +47,8 @@
"role": "Developer"
}
],
"scripts": {
"analyse": "phpstan"
},
"minimum-stability": "dev"
}
9 changes: 9 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
includes:
- ./vendor/larastan/larastan/extension.neon
- ./vendor/phpstan/phpstan-mockery/extension.neon

parameters:
paths:
- src
level: 8
checkMissingIterableValueType: false
6 changes: 4 additions & 2 deletions src/Responsive.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

use Statamic\Assets\Asset;
use Statamic\Statamic;
use Illuminate\Contracts\View\View;
use Illuminate\Contracts\View\Factory;

class Responsive
{
public static function handle(...$arguments)
public static function handle(mixed ...$arguments): Factory|View
{
$image = $arguments[0];
$image = get_class($image) === 'Statamic\Fields\Value' ? $image->value() : $image;
Expand All @@ -24,7 +26,7 @@ public static function handle(...$arguments)
]);
}

public static function getPresets(Asset $image)
public static function getPresets(Asset $image): array
{
$config = config('statamic.assets.image_manipulation.presets');

Expand Down

0 comments on commit 250d8f4

Please sign in to comment.