Skip to content

Commit

Permalink
Merge pull request #14 from TomBrouws/master
Browse files Browse the repository at this point in the history
Add support for PHP 8.2
  • Loading branch information
pgoodjohn authored Mar 22, 2023
2 parents 55a92ba + d61e3ac commit 8aff3a8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/composer-json-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.2"
operating-system:
- "ubuntu-latest"

Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ jobs:
strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
operating-system:
- "ubuntu-latest"

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ This package makes use of PHP-CS-Fixer.
This package provides default rules to be used with PHP-CS-Fixer.

You can find them in `Mollie\PhpCodingStandards\PhpCsFixer\Rules` which has methods specific to php version,
which you can directly use in the `->setRules()` part of your config. For example, assuming PHP version 7.3:
which you can directly use in the `->setRules()` part of your config. For example, assuming PHP version 8.2:

```php
use Mollie\PhpCodingStandards\PhpCsFixer\Rules;

$config->setRules(Rules::getForPhp73());
$config->setRules(Rules::getForPhp82());
```

### New to PHP-CS-Fixer
Expand All @@ -39,8 +39,8 @@ $finder = Finder::create()
return (new Config())
->setFinder($finder)
->setRiskyAllowed(true)
// use specific rules for your php version e.g.: getForPhp71, getForPhp72, getForPhp73
->setRules(Rules::getForPhp71());
// use specific rules for your php version e.g.: getForPhp74, getForPhp80, getForPhp81
->setRules(Rules::getForPhp74());
```

### Manual Triggering
Expand Down Expand Up @@ -90,4 +90,4 @@ strong opinions, and, most importantly, who know how to ship great products. Wan

## License
[BSD (Berkeley Software Distribution) License](https://opensource.org/licenses/bsd-license.php).
Copyright (c) 2019, Mollie B.V.
Copyright (c) 2023, Mollie B.V.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"require": {
"php": "^7.1.3 || ^8.0",
"friendsofphp/php-cs-fixer": "^3.1.0"
"friendsofphp/php-cs-fixer": "^3.15"
},
"minimum-stability": "stable",
"autoload": {
Expand Down
11 changes: 10 additions & 1 deletion src/PhpCsFixer/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Mollie\PhpCodingStandards\PhpCsFixer;

/*
* Last updated for php-cs-fixer version: 2.16
* Last updated for php-cs-fixer version: 3.15.1
*/
class Rules
{
Expand Down Expand Up @@ -75,6 +75,15 @@ public static function getForPhp81(array $overriddenRules = []): array
return array_merge(self::getForPhp80($specific81Rules), $overriddenRules);
}

public static function getForPhp82(array $overriddenRules = []): array
{
$specific82Rules = [
// At the moment there are no specific 8.2 rules or configurations
];

return array_merge(self::getForPhp81($specific82Rules), $overriddenRules);
}

private static function getBaseRules(): array
{
return [
Expand Down

0 comments on commit 8aff3a8

Please sign in to comment.