Skip to content

Commit 7a7c99a

Browse files
committed
Update to php-cs-fixer v3
1 parent 29504a3 commit 7a7c99a

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

.github/workflows/ci.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0']
15+
php-versions: ['7.2', '7.3', '7.4', '8.0']
16+
cs-fixer: [ true ]
17+
include:
18+
- php-versions: '7.1'
19+
cs-fixer: false
1620
steps:
1721
- name: Checkout
1822
uses: actions/checkout@v2
@@ -38,10 +42,15 @@ jobs:
3842
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
3943
restore-keys: ${{ runner.os }}-composer-
4044

45+
- name: Remove php-cs-fixer dependency when not used
46+
if: matrix.cs-fixer == false
47+
run: composer remove --dev friendsofphp/php-cs-fixer
48+
4149
- name: Install composer dependencies
4250
run: composer install --no-progress --prefer-dist --optimize-autoloader
4351

4452
- name: Code Analysis (PHP CS-Fixer)
53+
if: matrix.cs-fixer == true
4554
run: php vendor/bin/php-cs-fixer fix --dry-run --diff
4655

4756
- name: Code Analysis (PHPStan)

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ vendor
2323
nbproject
2424

2525
# Tests
26+
.php-cs-fixer.cache
2627
.php_cs.cache

.php_cs.dist .php-cs-fixer.dist.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<?php
22

3-
$config = PhpCsFixer\Config::create();
3+
$config = new PhpCsFixer\Config;
44
$config->getFinder()
55
->exclude('vendor')
66
->in(__DIR__);
77
$config->setRules([
88
'@PSR2' => true,
99
'@Symfony' => true,
10-
'binary_operator_spaces' => ['align_double_arrow' => true],
10+
'binary_operator_spaces' => [],
1111
'braces' => ['position_after_functions_and_oop_constructs' => 'same'],
1212
'concat_space' => ['spacing' => 'one'],
1313
'no_superfluous_phpdoc_tags' => false,
1414
'no_unneeded_control_parentheses' => false,
1515
'phpdoc_align' => false,
1616
'single_line_comment_style' => false,
1717
'single_quote' => false,
18-
'trailing_comma_in_multiline_array' => false,
18+
'trailing_comma_in_multiline' => true,
1919
'visibility_required' => false,
2020
'yoda_style' => false
2121
]);

Core/Frameworks/Flake/Util/Tools.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ static function gzdecode($data, &$filename = '', &$error = '', $maxlength = null
736736
if ($len - $headerlen - 2 < 8) {
737737
return false; // invalid
738738
}
739-
$calccrc = crc32(substr($data, 0, $headerlen)) & 0xffff;
739+
$calccrc = crc32(substr($data, 0, $headerlen)) & 0xFFFF;
740740
$headercrc = unpack("v", substr($data, $headerlen, 2));
741741
$headercrc = $headercrc[1];
742742
if ($headercrc != $calccrc) {

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"symfony/yaml" : "^3.4"
2020
},
2121
"require-dev" : {
22-
"friendsofphp/php-cs-fixer": "2.19.3",
22+
"friendsofphp/php-cs-fixer": "3.3.2",
2323
"phpstan/phpstan": "^1.2"
2424
},
2525
"replace" : {

0 commit comments

Comments
 (0)