Skip to content

Commit

Permalink
Merge pull request #144: Resolve PHP 8.4 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk authored Dec 7, 2024
2 parents df2ccbb + aac71ba commit 97ad260
Show file tree
Hide file tree
Showing 37 changed files with 531 additions and 664 deletions.
69 changes: 1 addition & 68 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,73 +124,6 @@ jobs:
run: .phive/composer-normalize --ansi --dry-run

coding-standards:
timeout-minutes: 4
runs-on: ${{ matrix.os }}
concurrency:
cancel-in-progress: true
group: coding-standards-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
strategy:
matrix:
os:
- ubuntu-latest
php-version:
- '8.1'
dependencies:
- locked
permissions:
contents: write
steps:
- name: ⚙️ Set git to use LF line endings
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: 🛠️ Setup PHP
uses: shivammathur/setup-php@2.30.4
with:
php-version: ${{ matrix.php-version }}
extensions: none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, sockets
ini-values: error_reporting=E_ALL
coverage: none

- name: 📦 Check out the codebase
uses: actions/checkout@v4.1.6

- name: 🛠️ Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: 🤖 Validate composer.json and composer.lock
run: composer validate --ansi --strict

- name: 🔍 Get composer cache directory
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0

- name: ♻️ Restore cached dependencies installed with composer
uses: actions/cache@v4.0.2
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-

- name: 📥 Install "${{ matrix.dependencies }}" dependencies with composer
uses: wayofdev/gh-actions/actions/composer/install@v3.1.0
with:
dependencies: ${{ matrix.dependencies }}

- name: 🛠️ Prepare environment
run: make prepare

- name: 🚨 Run coding standards task
run: composer cs:fix
env:
PHP_CS_FIXER_IGNORE_ENV: true

- name: 📤 Commit and push changed files back to GitHub
uses: stefanzweifel/git-auto-commit-action@v5.0.1
with:
commit_message: 'style(php-cs-fixer): lint php files and fix coding standards'
branch: ${{ github.head_ref }}
commit_author: 'github-actions <github-actions@users.noreply.github.com>'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master
24 changes: 8 additions & 16 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,13 @@

declare(strict_types=1);

use WayOfDev\PhpCsFixer\Config\ConfigBuilder;
use WayOfDev\PhpCsFixer\Config\RuleSets\ExtendedPERSet;

require_once 'vendor/autoload.php';

$config = ConfigBuilder::createFromRuleSet(new ExtendedPERSet())
->inDir(__DIR__ . '/bin')
->inDir(__DIR__ . '/src')
->inDir(__DIR__ . '/tests')
->exclude([
__DIR__ . '/src/Test/Proto',
])
->addFiles([__FILE__, __DIR__ . '/rector.php'])
->getConfig();

$config->setCacheFile(__DIR__ . '/.build/php-cs-fixer/php-cs-fixer.cache');

return $config;
return \Spiral\CodeStyle\Builder::create()
->include(__DIR__ . '/bin')
->include(__DIR__ . '/src')
->include(__DIR__ . '/tests')
->include(__DIR__ . '/rector.php')
->include(__FILE__)
->exclude(__DIR__ . '/src/Test/Proto')
->build();
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"require-dev": {
"dereuromark/composer-prefer-lowest": "^0.1.10",
"ergebnis/phpunit-slow-test-detector": "^2.14",
"friendsofphp/php-cs-fixer": "^3.54",
"google/protobuf": "^3.23",
"pestphp/pest": "^2.34",
"phpstan/extension-installer": "^1.3",
Expand All @@ -69,8 +68,8 @@
"phpunit/phpunit": "^10.5",
"rector/rector": "^1.1",
"roxblnfk/unpoly": "^1.8.1",
"vimeo/psalm": "^5.11",
"wayofdev/cs-fixer-config": "^1.4"
"spiral/code-style": "*",
"vimeo/psalm": "^5.11"
},
"suggest": {
"ext-simplexml": "To load trap.xml",
Expand Down
Loading

0 comments on commit 97ad260

Please sign in to comment.