diff --git a/.gitattributes b/.gitattributes index 4caa107..3ba48ea 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,14 +3,13 @@ # Ignore all test and documentation with "export-ignore". /.github export-ignore -/tests export-ignore -/.editorconfig export-ignore /.gitattributes export-ignore /.gitignore export-ignore -/.php-cs-fixer.dist.php export-ignore -/phpstan-baseline.neon export-ignore -/phpstan.neon.dist export-ignore /phpunit.xml.dist export-ignore +/tests export-ignore +/.editorconfig export-ignore +/phpstan.neon.dist export-ignore +/phpstan-baseline.neon export-ignore * text=auto diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml new file mode 100644 index 0000000..3b290d0 --- /dev/null +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -0,0 +1,28 @@ +name: Fix PHP code style issues + +on: + push: + paths: + - "**.php" + +permissions: + contents: write + +jobs: + php-code-styling: + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Fix PHP code style issues + uses: aglipanci/laravel-pint-action@2.5 + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Fix styling diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml deleted file mode 100644 index 62adcb2..0000000 --- a/.github/workflows/php-cs-fixer.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Check & fix styling - -on: [push] - -jobs: - php-cs-fixer: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} - - - name: Run PHP CS Fixer - uses: docker://oskarstark/php-cs-fixer-ga - with: - args: --config=.php-cs-fixer.dist.php --allow-risky=yes - - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: Fix styling diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 0ad43d5..e909777 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -17,8 +17,8 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest] - php: [8.4, 8.3, 8.2, 8.1, 8.0] - laravel: [12.*, 11.*, 10.*, 9.*] + php: [8.4, 8.3, 8.2, 8.1] + laravel: [12.*, 11.*, 10.*] stability: [prefer-lowest, prefer-stable] include: - laravel: 12.* @@ -27,19 +27,11 @@ jobs: testbench: 9.* - laravel: 10.* testbench: 8.* - - laravel: 9.* - testbench: 7.* exclude: - laravel: 12.* php: 8.1 - - laravel: 12.* - php: 8.0 - laravel: 11.* php: 8.1 - - laravel: 11.* - php: 8.0 - - laravel: 10.* - php: 8.0 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -59,11 +51,6 @@ jobs: echo "::add-matcher::${{ runner.tool_cache }}/php.json" echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - name: Fix dependencies - if: ${{ startsWith(matrix.laravel, '9') }} - run: | - composer require "nesbot/carbon:^2.72.6" --no-interaction --no-update - - name: Install dependencies run: | composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update diff --git a/.gitignore b/.gitignore index 9a43686..b60507f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,32 @@ -.idea -.php_cs -.php_cs.cache -.phpunit.result.cache -build +# Composer Related composer.lock -coverage -docs +/vendor + +# Frontend Assets +/node_modules + +# Logs +npm-debug.log +yarn-error.log + +# Caches +.phpunit.cache +.phpunit.result.cache +/build + +# IDE Helper +_ide_helper.php +_ide_helper_models.php +.phpstorm.meta.php + +# Editors +/.idea +/.fleet +/.vscode + +# Misc phpunit.xml phpstan.neon testbench.yaml -vendor -node_modules -.php-cs-fixer.cache +/docs +/coverage diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php deleted file mode 100644 index c63048f..0000000 --- a/.php-cs-fixer.dist.php +++ /dev/null @@ -1,44 +0,0 @@ -in([ - __DIR__ . '/src', - __DIR__ . '/tests', - ]) - ->name('*.php') - ->notName('*.blade.php') - ->ignoreDotFiles(true) - ->ignoreVCS(true); - -return (new Config()) - ->setRules([ - '@PSR12' => true, - 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => ['sort_algorithm' => 'alpha'], - 'no_unused_imports' => true, - 'not_operator_with_successor_space' => true, - 'trailing_comma_in_multiline' => true, - 'phpdoc_scalar' => true, - 'unary_operator_spaces' => true, - 'binary_operator_spaces' => true, - 'blank_line_before_statement' => [ - 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], - ], - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_var_without_name' => true, - 'class_attributes_separation' => [ - 'elements' => [ - 'method' => 'one', - ], - ], - 'method_argument_space' => [ - 'on_multiline' => 'ensure_fully_multiline', - 'keep_multiple_spaces_after_comma' => true, - ], - 'single_trait_insert_per_statement' => true, - 'single_quote' => true, - ]) - ->setFinder($finder); diff --git a/composer.json b/composer.json index b372ac4..b62bf08 100644 --- a/composer.json +++ b/composer.json @@ -19,21 +19,21 @@ "require": { "php": "^8.0", "doctrine/sql-formatter": "^1.1", - "illuminate/contracts": "^9.36.3 | ^10.0 | ^11.0 | ^12.0", - "illuminate/view": "^9.36.3 | ^10.0 | ^11.0 | ^12.0", - "spatie/laravel-package-tools": "^1.9.2" + "illuminate/contracts": "^10.0 | ^11.0 | ^12.0", + "illuminate/view": "^10.0 | ^11.0 | ^12.0", + "spatie/laravel-package-tools": "^1.16" }, "require-dev": { + "laravel/pint": "^1.14", "larastan/larastan": "^2.9 | ^3.0", - "nunomaduro/collision": "^6.0 | ^7.0 | ^8.0", - "orchestra/testbench": "^7.0 | ^8.0 | ^9.0 | ^10.0", - "pestphp/pest": "^1.21 | ^2.0 | ^3.0", - "pestphp/pest-plugin-laravel": "^1.1 | ^2.0 | ^3.0", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan-deprecation-rules": "^1.0 | ^2.0", + "nunomaduro/collision": "^8.1.1 | ^7.10.0", + "orchestra/testbench": "^8.22 | ^9.0 | ^10.0", + "pestphp/pest": "^3.0", + "pestphp/pest-plugin-laravel": "^3.0", + "phpstan/extension-installer": "^1.3 | ^2.0", + "phpstan/phpstan-deprecation-rules": "^1.1 | ^2.0", "phpstan/phpstan-phpunit": "^1.0 | ^2.0", - "phpstan/phpstan-strict-rules": "^1.0 | ^2.0", - "phpunit/phpunit": "^9.5.24 | ^10.5 | ^11.5" + "phpstan/phpstan-strict-rules": "^1.0 | ^2.0" }, "autoload": { "psr-4": { @@ -48,7 +48,8 @@ "scripts": { "phpstan": "vendor/bin/phpstan analyse", "test": "vendor/bin/pest", - "test-coverage": "vendor/bin/pest coverage" + "test-coverage": "vendor/bin/pest coverage", + "format": "vendor/bin/pint" }, "config": { "sort-packages": true, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 22d871d..38adf1a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,14 +1,10 @@ tests - - - ./src - - - - - - - + + + ./src + +