From e16a12a3bfbf604cfb082c783251996a0eb3c980 Mon Sep 17 00:00:00 2001 From: Cristiano Cinotti Date: Wed, 25 Sep 2024 17:28:59 +0200 Subject: [PATCH] Remove deprecations --- .github/workflows/ci.yml | 19 ++++++------------- composer.json | 2 +- src/Config.php | 13 +++++++------ 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d56a975..bf105c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,34 +8,27 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest, windows-latest, macOS-latest] - php-version: ['7.2', '7.3', '7.4', '8.0'] + php-version: ['8.0', '8.1', '8.2', '8.3'] runs-on: ${{ matrix.operating-system }} steps: - name: Fix autocrlf on Windows if: matrix.operating-system == 'windows-latest' run: git config --global core.autocrlf false - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} coverage: none - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache composer dependencies - uses: actions/cache@v2 + - name: Install composer dependencies + uses: ramsey/composer-install@v3 with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - name: Install dependencies - run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader + composer-options: "--prefer-dist --optimize-autoloader" - name: Create .php-cs-fixer.php if: matrix.operating-system != 'windows-latest' run: echo "getFinder()->in(__DIR__.'/src');return \$config;" > .php-cs-fixer.php - - name: Create .php-cs-fixer.phpon Windows + - name: Create .php-cs-fixer.php on Windows if: matrix.operating-system == 'windows-latest' run: | New-Item .php-cs-fixer.php diff --git a/composer.json b/composer.json index 61ca9e0..3046484 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ } }, "require" : { - "php" : ">=7.2", + "php" : ">=8.0", "friendsofphp/php-cs-fixer" : "^3" } } diff --git a/src/Config.php b/src/Config.php index d96691b..959fac1 100644 --- a/src/Config.php +++ b/src/Config.php @@ -26,13 +26,14 @@ public function getRules(): array { 'blank_line_before_statement' => [ 'statements' => ['return', 'throw', 'try', 'exit'] ], - 'braces' => [ - 'position_after_functions_and_oop_constructs' => 'same' + 'braces_position' => [ + 'classes_opening_brace' => 'same_line', + 'functions_opening_brace' => 'same_line' ], 'cast_spaces' => [ 'space' => 'single' ], - 'compact_nullable_typehint' => true, + 'compact_nullable_type_declaration' => true, 'concat_space' => [ 'spacing' => 'one' ], @@ -46,7 +47,6 @@ public function getRules(): array { 'function_declaration' => [ 'closure_function_spacing' => 'one' ], - 'function_typehint_space' => true, 'indentation_type' => true, 'lowercase_cast' => true, 'lowercase_keywords' => true, @@ -62,8 +62,7 @@ public function getRules(): array { 'no_leading_namespace_whitespace' => true, 'no_multiline_whitespace_around_double_arrow' => true, 'no_spaces_after_function_name' => true, - 'no_spaces_inside_parenthesis' => true, - 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_comma_in_singleline' => ['elements' => ['arguments', 'array_destructuring', 'array', 'group_import']], 'no_trailing_whitespace' => true, 'no_unused_imports' => true, 'no_whitespace_before_comma_in_array' => true, @@ -81,6 +80,8 @@ public function getRules(): array { 'single_import_per_statement' => true, 'single_line_after_imports' => true, 'single_quote' => true, + 'spaces_inside_parentheses' => ['space' => 'none'], + 'type_declaration_spaces' => ['elements' => ['function', 'property']], 'visibility_required' => true, 'whitespace_after_comma_in_array' => true ];