Update to php-cs-fixer v3

This commit is contained in:
Phil Davis 2021-11-26 09:41:04 +05:45
parent 29504a3164
commit 7a7c99aeff
No known key found for this signature in database
GPG key ID: 129103924A5A9744
5 changed files with 16 additions and 6 deletions

View file

@ -12,7 +12,11 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0']
php-versions: ['7.2', '7.3', '7.4', '8.0']
cs-fixer: [ true ]
include:
- php-versions: '7.1'
cs-fixer: false
steps:
- name: Checkout
uses: actions/checkout@v2
@ -38,10 +42,15 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Remove php-cs-fixer dependency when not used
if: matrix.cs-fixer == false
run: composer remove --dev friendsofphp/php-cs-fixer
- name: Install composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Code Analysis (PHP CS-Fixer)
if: matrix.cs-fixer == true
run: php vendor/bin/php-cs-fixer fix --dry-run --diff
- name: Code Analysis (PHPStan)

1
.gitignore vendored
View file

@ -23,4 +23,5 @@ vendor
nbproject
# Tests
.php-cs-fixer.cache
.php_cs.cache

View file

@ -1,13 +1,13 @@
<?php
$config = PhpCsFixer\Config::create();
$config = new PhpCsFixer\Config;
$config->getFinder()
->exclude('vendor')
->in(__DIR__);
$config->setRules([
'@PSR2' => true,
'@Symfony' => true,
'binary_operator_spaces' => ['align_double_arrow' => true],
'binary_operator_spaces' => [],
'braces' => ['position_after_functions_and_oop_constructs' => 'same'],
'concat_space' => ['spacing' => 'one'],
'no_superfluous_phpdoc_tags' => false,
@ -15,7 +15,7 @@ $config->setRules([
'phpdoc_align' => false,
'single_line_comment_style' => false,
'single_quote' => false,
'trailing_comma_in_multiline_array' => false,
'trailing_comma_in_multiline' => true,
'visibility_required' => false,
'yoda_style' => false
]);

View file

@ -736,7 +736,7 @@ TEST;
if ($len - $headerlen - 2 < 8) {
return false; // invalid
}
$calccrc = crc32(substr($data, 0, $headerlen)) & 0xffff;
$calccrc = crc32(substr($data, 0, $headerlen)) & 0xFFFF;
$headercrc = unpack("v", substr($data, $headerlen, 2));
$headercrc = $headercrc[1];
if ($headercrc != $calccrc) {

View file

@ -19,7 +19,7 @@
"symfony/yaml" : "^3.4"
},
"require-dev" : {
"friendsofphp/php-cs-fixer": "2.19.3",
"friendsofphp/php-cs-fixer": "3.3.2",
"phpstan/phpstan": "^1.2"
},
"replace" : {