From e8ca20f03168136a5baeb096571603aea4b5fff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=94=81?= <52o@qq52o.cn> Date: Sun, 3 Oct 2021 16:31:28 +0800 Subject: [PATCH] Upgraded friendsofphp/php-cs-fixer to ^3.0 (#2) --- .github/workflows/coding_style_checks.yml | 31 +++++++++++++++++++++++ .gitignore | 2 ++ .php_cs.dist => .php-cs-fixer.php | 6 ++--- composer.json | 2 +- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/coding_style_checks.yml rename .php_cs.dist => .php-cs-fixer.php (96%) diff --git a/.github/workflows/coding_style_checks.yml b/.github/workflows/coding_style_checks.yml new file mode 100644 index 0000000..63399e6 --- /dev/null +++ b/.github/workflows/coding_style_checks.yml @@ -0,0 +1,31 @@ +name: Coding Style Checks + +on: [ push, pull_request, workflow_dispatch ] + +jobs: + ci: + name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.os }} + runs-on: "${{ matrix.os }}" + strategy: + matrix: + os: [ubuntu-latest] + php-versions: ['7.2', '7.3', '7.4', '8.0'] + max-parallel: 4 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + tools: phpize + coverage: none + + - name: Setup Deps + run: + composer install -o + + - name: Coding Style Checks + run: + composer cs-check diff --git a/.gitignore b/.gitignore index a75dba1..71fd6f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /vendor/ composer.lock .idea +config.php +properties.php diff --git a/.php_cs.dist b/.php-cs-fixer.php similarity index 96% rename from .php_cs.dist rename to .php-cs-fixer.php index f095f38..b677977 100644 --- a/.php_cs.dist +++ b/.php-cs-fixer.php @@ -21,7 +21,7 @@ please view the LICENSE file that was distributed with this source code TEXT; -return PhpCsFixer\Config::create() +return (new PhpCsFixer\Config()) ->setRiskyAllowed(true) ->setRules([ '@PSR2' => true, @@ -29,7 +29,7 @@ '@DoctrineAnnotation' => true, '@PhpCsFixer' => true, 'header_comment' => [ - 'commentType' => 'PHPDoc', + 'comment_type' => 'PHPDoc', 'header' => $header, 'separate' => 'bottom', 'location' => 'after_open', @@ -85,7 +85,7 @@ 'combine_consecutive_unsets' => true, 'declare_strict_types' => true, 'linebreak_after_opening_tag' => true, - 'lowercase_constants' => true, + 'constant_case' => true, 'lowercase_static_reference' => true, 'no_useless_else' => true, 'no_unused_imports' => true, diff --git a/composer.json b/composer.json index 5df878d..c55aae9 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "require": { "symfony/console": "^5.2", "simps/mqtt": "^1.3", - "friendsofphp/php-cs-fixer": "^2.18", + "friendsofphp/php-cs-fixer": "^3.0", "ext-json": "*" }, "autoload": {