diff --git a/.gitattributes b/.gitattributes index e8a4827..c5474b7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13,7 +13,7 @@ /phpunit.xml.dist export-ignore /tests export-ignore /.editorconfig export-ignore -/.php_cs.dist export-ignore +/.php-cs-fixer.dist.php export-ignore /.github export-ignore /psalm.xml export-ignore /psalm.xml.dist export-ignore \ No newline at end of file diff --git a/.github/workflows/format_php.yaml b/.github/workflows/format_php.yaml index af2a001..13f31d5 100644 --- a/.github/workflows/format_php.yaml +++ b/.github/workflows/format_php.yaml @@ -13,7 +13,7 @@ jobs: - name: Run php-cs-fixer uses: docker://oskarstark/php-cs-fixer-ga with: - args: --config=.php_cs.dist + args: --config=.php-cs-fixer.dist.php - uses: stefanzweifel/git-auto-commit-action@v4.1.0 with: diff --git a/.gitignore b/.gitignore index 960f05e..e001030 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .idea .php_cs .php_cs.cache +.php-cs-fixer.cache .phpunit.result.cache build /composer.lock diff --git a/.php_cs.dist b/.php-cs-fixer.dist.php similarity index 83% rename from .php_cs.dist rename to .php-cs-fixer.dist.php index 337e68a..2bbda9b 100644 --- a/.php_cs.dist +++ b/.php-cs-fixer.dist.php @@ -4,15 +4,15 @@ ->exclude('Fixtures') ->in([__DIR__.'/src', __DIR__.'/tests']); -return PhpCsFixer\Config::create() +return (new PhpCsFixer\Config()) ->setFinder($finder) ->setRules([ '@PSR2' => true, 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => ['sortAlgorithm' => 'alpha'], + 'ordered_imports' => ['sort_algorithm' => 'alpha'], 'no_unused_imports' => true, 'not_operator_with_successor_space' => true, - 'trailing_comma_in_multiline_array' => true, + 'trailing_comma_in_multiline' => ['elements' => ['arrays']], 'phpdoc_scalar' => true, 'unary_operator_spaces' => true, 'binary_operator_spaces' => true, @@ -23,7 +23,7 @@ 'phpdoc_var_without_name' => true, 'class_attributes_separation' => [ 'elements' => [ - 'method', + 'method' => 'one', ], ], 'method_argument_space' => [ diff --git a/composer.json b/composer.json index 024e72a..13070dc 100644 --- a/composer.json +++ b/composer.json @@ -27,15 +27,15 @@ "require": { "php": ">=5.6", "ext-json": "*", - "symfony/console": "^3.4|^4|^5", - "symfony/finder": "^3|^4|^5", - "symfony/process": "^3.4|^4|^5", - "symfony/yaml": "^3.4|^4|^5", + "symfony/console": "^3.4|^4|^5|^6", + "symfony/finder": "^3|^4|^5|^6", + "symfony/process": "^3.4|^4|^5|^6", + "symfony/yaml": "^3.4|^4|^5|^6", "guzzlehttp/guzzle": "^6.3|^7.0" }, "require-dev": { "ext-zip" : "*", - "friendsofphp/php-cs-fixer": "^2.18", + "friendsofphp/php-cs-fixer": "^2.18|^3.0", "phpunit/phpunit": "^5.5|^6|^7|^8|^9" }, "bin": ["security-checker"], diff --git a/tests/AdvisoryParserTest.php b/tests/AdvisoryParserTest.php index 043e636..cd61060 100644 --- a/tests/AdvisoryParserTest.php +++ b/tests/AdvisoryParserTest.php @@ -62,7 +62,7 @@ public function ignores_vulnerabilities_from_allow_list_by_vce() $this->getAdvisoryParser(); $advisories = $this->parser->getAdvisories([ - 'CVE-2017-9303' + 'CVE-2017-9303', ]); $this->assertContains([ @@ -106,7 +106,7 @@ public function ignores_vulnerabilities_from_allow_list_by_title() $this->getAdvisoryParser(); $advisories = $this->parser->getAdvisories([ - 'Risk of mass-assignment vulnerabilities' + 'Risk of mass-assignment vulnerabilities', ]); $this->assertNotContains([ diff --git a/tests/SecurityCheckerCommandTest.php b/tests/SecurityCheckerCommandTest.php index 3e7681f..b2ec0af 100644 --- a/tests/SecurityCheckerCommandTest.php +++ b/tests/SecurityCheckerCommandTest.php @@ -96,8 +96,8 @@ public function can_allow_vulnerabilities_by_cve() $commandTester->execute([ 'lockfile' => $lockFile, '--allow-list' => [ - 'CVE-2017-9841' - ] + 'CVE-2017-9841', + ], ]); $this->assertEquals(0, $commandTester->getStatusCode()); @@ -117,8 +117,8 @@ public function can_allow_vulnerabilities_by_title() $commandTester->execute([ 'lockfile' => $lockFile, '--allow-list' => [ - 'RCE vulnerability in phpunit' - ] + 'RCE vulnerability in phpunit', + ], ]); $this->assertEquals(0, $commandTester->getStatusCode());