Skip to content

Commit

Permalink
Merge pull request #109 from TheDragonCode/3.x
Browse files Browse the repository at this point in the history
Upgrade project
  • Loading branch information
andrey-helldar committed Jun 2, 2023
2 parents 430cef2 + 80e215c commit 03b5ee5
Show file tree
Hide file tree
Showing 33 changed files with 2,221 additions and 852 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 180
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = false
trim_trailing_whitespace = true
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- name: Checking PHP Syntax
uses: ./

check:
if: ${{ ! (github.event_name == 'push' && github.ref == 'refs/heads/main') }}

Expand All @@ -31,10 +31,10 @@ jobs:

- name: Checking PHP Syntax
uses: TheDragonCode/codestyler@v2

fix:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

runs-on: ubuntu-latest

steps:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ "8.0", "8.1", "8.2" ]
php: [ "8.1", "8.2" ]

name: PHP ${{ matrix.php }}

Expand All @@ -23,11 +23,11 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json
coverage: none
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json, xdiff
coverage: xdebug

- name: Install dependencies
run: composer update --prefer-stable --prefer-dist --no-progress --no-interaction
run: composer update --prefer-stable --prefer-dist --no-progress --no-interaction --ignore-platform-req=ext-xdiff

- name: Execute tests
run: sudo vendor/bin/phpunit --colors=always
2 changes: 1 addition & 1 deletion .github/workflows/update-major-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
id: version
run: |
TAG=${{ github.event.release.tag_name }}
echo "full_version=${TAG}" >> $GITHUB_OUTPUT
echo "major_version=${TAG:0:2}" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG INPUT_EDITORCONFIG
ARG INPUT_DEPENDABOT
ARG INPUT_NORMALIZE

RUN composer global require dragon-code/codestyler:^2.6
RUN composer global require dragon-code/codestyler:^3.0 --ignore-platform-req=ext-xdiff

COPY shell /shell
COPY entrypoint.sh /entrypoint.sh
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The Dragon Code Styler

![the dragon code php code styler](https://preview.dragon-code.pro/the-dragon-code/code-styler.svg?brand=github&invert=1)
![the dragon code code styler](https://preview.dragon-code.pro/the-dragon-code/code-styler.svg?brand=php&invert=1)

[![Stable Version][badge_stable]][link_repo]
[![Unstable Version][badge_unstable]][link_repo]
Expand All @@ -26,7 +26,7 @@ When you run the commands in the base path of the project, the `composer.json` f

This is necessary to draw up rules for applying the codestyle.

For example, if your project supports PHP 7.2 and above, and you use the `mkdir($path, 0755)` function in it, then applying the rules for PHP 8.0 will break your code because it
For example, if your project supports PHP 8.0 and above, and you use the `mkdir($path, 0755)` function in it, then applying the rules for PHP 8.0 will break your code because it
will replace `0755` with `0o755` (`mkdir($path, 0o755)`).

To prevent this from happening, we check the minimum PHP version.
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
uses: actions/checkout@v2

- name: Checking PHP Syntax
uses: TheDragonCode/codestyler@v2
uses: TheDragonCode/codestyler@v3
```

#### Fixer
Expand All @@ -103,7 +103,7 @@ jobs:
uses: actions/checkout@v2

- name: Checking PHP Syntax
uses: TheDragonCode/codestyler@v2
uses: TheDragonCode/codestyler@v3
with:
# This token uses GitHub Actions to execute code.
# Required when `fix` is `true`.
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
uses: actions/checkout@v3

- name: Checking PHP Syntax
uses: TheDragonCode/codestyler@v2
uses: TheDragonCode/codestyler@v3

fix:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
Expand All @@ -171,7 +171,7 @@ jobs:
uses: actions/checkout@v3

- name: Checking PHP Syntax
uses: TheDragonCode/codestyler@v2
uses: TheDragonCode/codestyler@v3
with:
github_token: ${{ secrets.YOUR_TOKEN }}
fix: true
Expand All @@ -191,13 +191,13 @@ codestyle <command>
By default, the linter scans all files in the current launch folder, except for folders such as `vendor`, `node_modules` and `.github`.

```yaml
- uses: TheDragonCode/codestyler@v2
- uses: TheDragonCode/codestyler@v3
```

By default, the linter only checks the code-style. If you want to apply the changes, then you need to activate this option:

```yaml
- uses: TheDragonCode/codestyler@v2
- uses: TheDragonCode/codestyler@v3
with:
fix: true
```
Expand Down
19 changes: 10 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.1",
"ext-json": "*",
"dragon-code/support": "^6.1",
"friendsofphp/php-cs-fixer": "^3.10",
"symfony/console": "^5.0 || ^6.0",
"symfony/yaml": "^5.0 || ^6.0"
"ext-xdiff": "*",
"dragon-code/pretty-array": "^4.1",
"dragon-code/support": "^6.11.2",
"laravel/pint": "^1.10",
"symfony/console": "^5.0 || ^6.3",
"symfony/var-dumper": "^5.0 || ^6.3",
"symfony/yaml": "^5.0 || ^6.3"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"symfony/var-dumper": "^5.0 || ^6.0"
"phpunit/phpunit": "^9.6.8"
},
"minimum-stability": "stable",
"autoload": {
Expand All @@ -57,8 +59,7 @@
"config": {
"allow-plugins": {
"dragon-code/codestyler": true,
"ergebnis/composer-normalize": true,
"friendsofphp/php-cs-fixer": true
"ergebnis/composer-normalize": true
}
}
}
19 changes: 0 additions & 19 deletions rules/7.2-risky.php

This file was deleted.

15 changes: 0 additions & 15 deletions rules/7.2.php

This file was deleted.

20 changes: 0 additions & 20 deletions rules/7.3-risky.php

This file was deleted.

16 changes: 0 additions & 16 deletions rules/7.3.php

This file was deleted.

22 changes: 0 additions & 22 deletions rules/7.4-risky.php

This file was deleted.

17 changes: 0 additions & 17 deletions rules/7.4.php

This file was deleted.

24 changes: 0 additions & 24 deletions rules/8.0-risky.php

This file was deleted.

18 changes: 0 additions & 18 deletions rules/8.0.php

This file was deleted.

Loading

0 comments on commit 03b5ee5

Please sign in to comment.