Update to php-cs-fixer v3
This commit is contained in:
parent
29504a3164
commit
7a7c99aeff
5 changed files with 16 additions and 6 deletions
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
|
@ -12,7 +12,11 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
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:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -38,10 +42,15 @@ jobs:
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
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
|
- name: Install composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Code Analysis (PHP CS-Fixer)
|
- name: Code Analysis (PHP CS-Fixer)
|
||||||
|
if: matrix.cs-fixer == true
|
||||||
run: php vendor/bin/php-cs-fixer fix --dry-run --diff
|
run: php vendor/bin/php-cs-fixer fix --dry-run --diff
|
||||||
|
|
||||||
- name: Code Analysis (PHPStan)
|
- name: Code Analysis (PHPStan)
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -23,4 +23,5 @@ vendor
|
||||||
nbproject
|
nbproject
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
|
.php-cs-fixer.cache
|
||||||
.php_cs.cache
|
.php_cs.cache
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$config = PhpCsFixer\Config::create();
|
$config = new PhpCsFixer\Config;
|
||||||
$config->getFinder()
|
$config->getFinder()
|
||||||
->exclude('vendor')
|
->exclude('vendor')
|
||||||
->in(__DIR__);
|
->in(__DIR__);
|
||||||
$config->setRules([
|
$config->setRules([
|
||||||
'@PSR2' => true,
|
'@PSR2' => true,
|
||||||
'@Symfony' => true,
|
'@Symfony' => true,
|
||||||
'binary_operator_spaces' => ['align_double_arrow' => true],
|
'binary_operator_spaces' => [],
|
||||||
'braces' => ['position_after_functions_and_oop_constructs' => 'same'],
|
'braces' => ['position_after_functions_and_oop_constructs' => 'same'],
|
||||||
'concat_space' => ['spacing' => 'one'],
|
'concat_space' => ['spacing' => 'one'],
|
||||||
'no_superfluous_phpdoc_tags' => false,
|
'no_superfluous_phpdoc_tags' => false,
|
||||||
|
@ -15,7 +15,7 @@ $config->setRules([
|
||||||
'phpdoc_align' => false,
|
'phpdoc_align' => false,
|
||||||
'single_line_comment_style' => false,
|
'single_line_comment_style' => false,
|
||||||
'single_quote' => false,
|
'single_quote' => false,
|
||||||
'trailing_comma_in_multiline_array' => false,
|
'trailing_comma_in_multiline' => true,
|
||||||
'visibility_required' => false,
|
'visibility_required' => false,
|
||||||
'yoda_style' => false
|
'yoda_style' => false
|
||||||
]);
|
]);
|
|
@ -736,7 +736,7 @@ TEST;
|
||||||
if ($len - $headerlen - 2 < 8) {
|
if ($len - $headerlen - 2 < 8) {
|
||||||
return false; // invalid
|
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 = unpack("v", substr($data, $headerlen, 2));
|
||||||
$headercrc = $headercrc[1];
|
$headercrc = $headercrc[1];
|
||||||
if ($headercrc != $calccrc) {
|
if ($headercrc != $calccrc) {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"symfony/yaml" : "^3.4"
|
"symfony/yaml" : "^3.4"
|
||||||
},
|
},
|
||||||
"require-dev" : {
|
"require-dev" : {
|
||||||
"friendsofphp/php-cs-fixer": "2.19.3",
|
"friendsofphp/php-cs-fixer": "3.3.2",
|
||||||
"phpstan/phpstan": "^1.2"
|
"phpstan/phpstan": "^1.2"
|
||||||
},
|
},
|
||||||
"replace" : {
|
"replace" : {
|
||||||
|
|
Loading…
Reference in a new issue