Skip to content

Commit 7ce509e

Browse files
author
Alex
authored
Merge pull request #22 from kellerkinderDE/noticket/add-PHP81
[noticket] Add PHP81 and PHP82 support and drop support for PHP71, PHP72 and PHP73
2 parents 021dd48 + 64d66a8 commit 7ce509e

10 files changed

Lines changed: 25 additions & 46 deletions

File tree

.php-cs-fixer.dist.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require 'vendor/autoload.php';
44

55
$finder = PhpCsFixer\Finder::create()
6-
->in(__DIR__);
6+
->in(__DIR__ . '/src/');
77

8-
return K10r\Codestyle\PHP71::create()
9-
->setFinder($finder);
8+
return K10r\Codestyle\PHP74::create($finder);

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ First require the package via composer:
77

88
## Choose a version
99
After that, decide which configuration you want to use, currently the following configurations are supported:
10-
- PHP 7.1
11-
- PHP 7.2
12-
- PHP 7.3
1310
- PHP 7.4
1411
- PHP 8.0
12+
- PHP 8.1
13+
- PHP 8.2 (copy of PHP 8.1)
14+
15+
## Notice
16+
Due to the use of (FriendsOfPHP/PHP-CS-Fixer)[https://github.com/FriendsOfPHP/PHP-CS-Fixer] the cs-fixer currently currently only be executed with PHP7.4 and PHP8.0.
17+
18+
Otherwise you need to use the ENV-Variable `PHP_CS_FIXER_IGNORE_ENV="true"`.
1519

1620
## Implementation
1721
- Create a `.php-cs-fixer.dist.php` or add the one provided by the project to the root folder of your project.

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"K10r\\Codestyle\\": "src/"
2121
}
2222
},
23-
"bin": [
24-
"php-cs-fixer"
25-
]
23+
"require": {
24+
"friendsofphp/php-cs-fixer": "^3.11"
25+
}
2626
}

php-cs-fixer

-2.09 MB
Binary file not shown.

src/DefaultRules.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ abstract class DefaultRules
7878
'method',
7979
],
8080
],
81-
'yoda_style' => [
82-
'equal' => false,
83-
'identical' => false,
81+
'yoda_style' => [
82+
'equal' => false,
83+
'identical' => false,
8484
'less_and_greater' => false,
8585
],
8686
];

src/PHP73.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/PHP74.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ final class PHP74 extends DefaultRules
1111
*/
1212
public static function getRules(): array
1313
{
14-
return PHP73::getRules();
14+
return DefaultRules::getRules();
1515
}
1616
}

src/PHP80.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ final class PHP80 extends DefaultRules
1111
*/
1212
public static function getRules(): array
1313
{
14-
return PHP74::getRules();
14+
return array_merge(PHP74::getRules(), [
15+
'@PHP80Migration' => true,
16+
]);
1517
}
1618
}

src/PHP71.php renamed to src/PHP81.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44

55
namespace K10r\Codestyle;
66

7-
final class PHP71 extends DefaultRules
7+
final class PHP81 extends DefaultRules
88
{
99
/**
1010
* {@inheritdoc}
1111
*/
1212
public static function getRules(): array
1313
{
14-
return DefaultRules::RULES;
14+
return array_merge(PHP80::getRules(), [
15+
'@PHP81Migration' => true,
16+
]);
1517
}
1618
}

src/PHP72.php renamed to src/PHP82.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
namespace K10r\Codestyle;
66

7-
final class PHP72 extends DefaultRules
7+
final class PHP82 extends DefaultRules
88
{
99
/**
1010
* {@inheritdoc}
1111
*/
1212
public static function getRules(): array
1313
{
14-
return PHP71::getRules();
14+
return PHP81::getRules();
1515
}
1616
}

0 commit comments

Comments
 (0)