From 0be5494c91c123927c6c261f1912d51ce73cd6b4 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 26 Jul 2025 00:51:21 +0300 Subject: [PATCH] Bump codestyler --- .github/workflows/code-style.yml | 18 +---- .github/workflows/{phpunit.yml => tests.yml} | 0 composer.json | 9 +++ pint.json | 83 ++++++++++++++++++++ 4 files changed, 93 insertions(+), 17 deletions(-) rename .github/workflows/{phpunit.yml => tests.yml} (100%) create mode 100644 pint.json diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index f517a26..76b373c 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -8,8 +8,6 @@ permissions: write-all jobs: check: - if: ${{ ! (github.event_name == 'push' && github.ref == 'refs/heads/main') }} - runs-on: ubuntu-latest steps: @@ -17,19 +15,5 @@ jobs: uses: actions/checkout@v4 - name: Checking PHP Syntax - uses: TheDragonCode/codestyler@v5 + run: vendor/bin/pint --test - fix: - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Checking PHP Syntax - uses: TheDragonCode/codestyler@v5 - with: - github_token: ${{ secrets.COMPOSER_TOKEN }} - fix: true diff --git a/.github/workflows/phpunit.yml b/.github/workflows/tests.yml similarity index 100% rename from .github/workflows/phpunit.yml rename to .github/workflows/tests.yml diff --git a/composer.json b/composer.json index 0f1ae84..35163a3 100644 --- a/composer.json +++ b/composer.json @@ -41,6 +41,7 @@ "illuminate/collections": "^8.75 || ^9.0 || ^10.0 || ^11.0 || ^12.0" }, "require-dev": { + "dragon-code/codestyler": "^6.0", "fakerphp/faker": "^1.21", "illuminate/database": "^8.75 || ^9.0 || ^10.0 || ^11.0 || ^12.0", "phpunit/phpunit": "^9.6 || ^10.0 || ^11.0 || ^12.0", @@ -67,5 +68,13 @@ }, "preferred-install": "dist", "sort-packages": true + }, + "scripts": { + "post-update-cmd": [ + "cp vendor/dragon-code/codestyler/presets/pint/8.2.json pint.json", + "cp vendor/dragon-code/codestyler/.editorconfig .editorconfig", + "composer normalize" + ], + "style": "vendor/bin/pint --parallel" } } diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..2a60534 --- /dev/null +++ b/pint.json @@ -0,0 +1,83 @@ +{ + "preset": "laravel", + "rules": { + "@PHP71Migration": true, + "@PHP73Migration": true, + "@PHP74Migration": true, + "@PHP80Migration": true, + "@PHP81Migration": true, + "@PHP82Migration": true, + "concat_space": { + "spacing": "one" + }, + "blank_line_before_statement": { + "statements": [ + "declare", + "phpdoc", + "continue", + "return" + ] + }, + "class_attributes_separation": { + "elements": { + "case": "none", + "const": "none", + "method": "one", + "property": "one", + "trait_import": "none" + } + }, + "class_definition": { + "multi_line_extends_each_single_line": true, + "single_item_single_line": true, + "single_line": true, + "space_before_parenthesis": true + }, + "combine_consecutive_issets": true, + "combine_consecutive_unsets": true, + "braces_position": { + "allow_single_line_anonymous_functions": true, + "allow_single_line_empty_anonymous_classes": true, + "anonymous_classes_opening_brace": "same_line" + }, + "escape_implicit_backslashes": { + "double_quoted": true, + "heredoc_syntax": true, + "single_quoted": false + }, + "global_namespace_import": { + "import_classes": true, + "import_constants": true, + "import_functions": true + }, + "multiline_comment_opening_closing": true, + "no_superfluous_elseif": true, + "no_useless_else": true, + "operator_linebreak": { + "only_booleans": false + }, + "ordered_types": { + "null_adjustment": "always_last", + "sort_algorithm": "alpha" + }, + "phpdoc_line_span": { + "const": "single", + "method": "multi", + "property": "single" + }, + "return_assignment": true, + "simplified_if_return": true, + "phpdoc_param_order": true, + "fully_qualified_strict_types": true, + "declare_strict_types": true, + "types_spaces": { + "space_multiple_catch": "none" + }, + "binary_operator_spaces": { + "default": "align_single_space_minimal" + }, + "php_unit_method_casing": { + "case": "camel_case" + } + } +}