Skip to content

Commit

Permalink
Merge pull request #237 from TheDragonCode/5.x
Browse files Browse the repository at this point in the history
Added PHP 8.4 support
  • Loading branch information
andrey-helldar authored Nov 26, 2024
2 parents 8990c82 + 68524e8 commit eb164d9
Show file tree
Hide file tree
Showing 15 changed files with 1,492 additions and 960 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json, dom, curl, libxml, fileinfo, tokenizer, xml
ini-values: error_reporting=E_ALL
coverage: none
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
fail-fast: true
matrix:
os: [ "ubuntu-latest", "windows-latest" ]
php: [ "8.1", "8.2", "8.3" ]
php: [ "8.2", "8.3", "8.4" ]

name: check on ${{ matrix.os }} with PHP ${{ matrix.php }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-phar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json, dom, curl, libxml, fileinfo, tokenizer, xml
ini-values: error_reporting=E_ALL
coverage: none
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: true
matrix:
os: [ "ubuntu-latest", "windows-latest" ]
php: [ "8.1", "8.2", "8.3" ]
php: [ "8.2", "8.3", "8.4" ]

name: PHP ${{ matrix.php }} - ${{ matrix.os }}

Expand Down
139 changes: 6 additions & 133 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ and [PHP-CS-Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer), and makes it s
stays clean and consistent.

By default, `Codestyler` does not require any configuration and will fix code style issues in your code by following
the opinionated coding style of `The Dragon Code` based on the [`PER`](https://www.php-fig.org/per/coding-style/) rule
the opinionated coding style of `The Dragon Code` based on the [`PER-2.0`](https://www.php-fig.org/per/coding-style/) rule
set.


Expand All @@ -29,8 +29,10 @@ set.

### Required

- PHP: ^8.1
- Composer: ^2.0
| Package | PHP |
|---------|-----------|
| `^5.0` | 8.2 - 8.4 |
| `^4.0` | 8.1 - 8.3 |

### Locally

Expand Down Expand Up @@ -160,136 +162,7 @@ codestyle dependabot --help
codestyle editorconfig --help
```

### GitHub Action

> ATTENTION
>
> Starting with code styler version 4.2.0, we will no longer support
> a [container](https://github.com/marketplace/actions/the-dragon-code-styler) for GitHub Actions.
>
> Instead, use direct dependency installation using the examples below.
Create a new `.github/workflows/code-style.yml` file and add the content to it:

```yaml
name: Code Style

on: [ push, pull_request ]

permissions: write-all

jobs:
check:
runs-on: ubuntu-latest

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

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json
coverage: none

- name: Install dependency
run: composer global require dragon-code/codestyler

- name: Check the code-style
run: codestyle --test

fix:
runs-on: ubuntu-latest

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

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json
coverage: none

- name: Setup Composer
run: |
composer global config --no-plugins allow-plugins.dragon-code/codestyler true
composer global config --no-plugins allow-plugins.ergebnis/composer-normalize true
composer config --no-plugins allow-plugins.dragon-code/codestyler true
composer config --no-plugins allow-plugins.ergebnis/composer-normalize true
- name: Install dependencies
run: |
composer global require dragon-code/codestyler
composer global require ergebnis/composer-normalize
- name: Fix the code-style
run: |
# Copies the `.editorconfig` file to the folder from which the command is run.
# The file contains a complete set of instructions for the IDE that supports EditorConfig.
codestyle editorconfig
# Copies the `The_Dragon_Code_phpStorm.xml` file to the folder from which the command is run.
# The file contains a complete set of instructions for JetBrains PhpStorm.
codestyle phpstorm
# Creates or updates the `dependabot.yml` file for GitHub Actions.
codestyle dependabot
# The main script for fixing the project code style
codestyle
# Provides a composer plugin for normalizing `composer.json`.
composer normalize
- name: Create a Pull Request
uses: peter-evans/create-pull-request@v6
with:
branch: code-style
branch-suffix: random
delete-branch: true
title: "🦋 The code style has been fixed"
commit-message: 🦋 The code style has been fixed
body: The code style has been fixed
labels: code-style
```
You can also use a simplified version of the configuration by linking to our settings.
In this case, the following settings will be applied:
- Always checks if the event is not equal to `push` or the branch is not equal to `main`
- Correcting the code style will take the following steps:
- Will add the following plugins to the list
of [allowed plugins](https://getcomposer.org/doc/06-config.md#allow-plugins)
in your `composer.json` file:
- `dragon-code/codestyler`
- `ergebnis/composer-normalize`
- Updates the `.github/dependabot.yml` file
- Updates the `.editorconfig` file
- Will correct the order of elements in the `composer.json` file to match
the [official schema](https://github.com/composer/composer/blob/main/res/composer-schema.json).
- Corrects the code style of your project.

```yml
name: Code Style
on: [ push, pull_request ]
permissions: write-all
jobs:
style:
name: Code Style
uses: TheDragonCode/.github/.github/workflows/code-style.yml@main
```

### Other CI/CD
### CI/CD

```bash
composer global require dragon-code/codestyler
Expand Down
4 changes: 2 additions & 2 deletions app/Enums/PhpVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ enum PhpVersion: string
{
use Values;

case v81 = '8.1';
case v81risky = '8.1-risky';
case v82 = '8.2';
case v82risky = '8.2-risky';
case v83 = '8.3';
case v83risky = '8.3-risky';
case v84 = '8.4';
case v84risky = '8.4-risky';
}
4 changes: 2 additions & 2 deletions app/Helpers/PhpVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

class PhpVersion
{
public const DEFAULT = '8.3';
public const MIN = '8.1';
public const DEFAULT = '8.4';
public const MIN = '8.2';

public static function get(): string
{
Expand Down
4 changes: 2 additions & 2 deletions app/Output/SummaryOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
class SummaryOutput extends BaseOutput
{
protected $presets = [
'8.1' => 'PHP 8.1',
'8.1-risky' => 'PHP 8.1 with risky',
'8.2' => 'PHP 8.2',
'8.2-risky' => 'PHP 8.2 with risky',
'8.3' => 'PHP 8.3',
'8.3-risky' => 'PHP 8.3 with risky',
'8.4' => 'PHP 8.4',
'8.4-risky' => 'PHP 8.4 with risky',
];
}
28 changes: 14 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
Expand All @@ -54,19 +54,19 @@
"ext-xml": "*"
},
"require-dev": {
"archtechx/enums": "^1.0",
"archtechx/enums": "^1.1",
"dragon-code/pretty-array": "^4.1",
"dragon-code/support": "^6.12.0",
"friendsofphp/php-cs-fixer": "^3.49.0",
"illuminate/view": "^10.44.0",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.20.0",
"laravel-zero/framework": "^10.3.0",
"mockery/mockery": "^1.6.7",
"nunomaduro/termwind": "^1.15.1",
"pedrotroller/php-cs-custom-fixer": "^2.33.0",
"pestphp/pest": "^2.33.6",
"seld/jsonlint": "^1.10.2",
"symfony/yaml": "^6.4.3 || ^7.0"
"dragon-code/support": "^6.15.0",
"friendsofphp/php-cs-fixer": "^3.65.0",
"illuminate/view": "^11.33.2",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.22.0",
"laravel-zero/framework": "^11.0.3",
"mockery/mockery": "^1.6.12",
"nunomaduro/termwind": "^2.3",
"pedrotroller/php-cs-custom-fixer": "^2.33.2",
"pestphp/pest": "^3.5.1",
"seld/jsonlint": "^1.11.0",
"symfony/yaml": "^6.4.3 || ^7.1.6"
},
"minimum-stability": "stable",
"prefer-stable": true,
Expand All @@ -93,7 +93,7 @@
},
"optimize-autoloader": true,
"platform": {
"php": "8.1.20"
"php": "8.2.26"
},
"preferred-install": "dist",
"sort-packages": true
Expand Down
Loading

0 comments on commit eb164d9

Please sign in to comment.