Skip to content

Commit 55a92ba

Browse files
Merge pull request #13 from peter-mein-mollie/upgrade-to-up-to-php-81
Added support for 8.0 and 8.1 rules
2 parents 96d40ef + ae0325f commit 55a92ba

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

.github/workflows/php-cs-fixer.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- "7.3"
1919
- "7.4"
2020
- "8.0"
21+
- "8.1"
2122
operating-system:
2223
- "ubuntu-latest"
2324

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "mollie/php-coding-standards",
3-
"type": "library",
43
"description": "Contains PHP coding standards like rules for PHP-CS-Fixer that serves for purpose of standardization.",
54
"license": "BSD-2-Clause",
5+
"type": "library",
66
"authors": [
77
{
88
"name": "Mollie B.V.",
@@ -13,10 +13,10 @@
1313
"php": "^7.1.3 || ^8.0",
1414
"friendsofphp/php-cs-fixer": "^3.1.0"
1515
},
16+
"minimum-stability": "stable",
1617
"autoload": {
1718
"psr-4": {
1819
"Mollie\\PhpCodingStandards\\": "src/"
1920
}
20-
},
21-
"minimum-stability": "stable"
21+
}
2222
}

src/PhpCsFixer/Rules.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@
99
*/
1010
class Rules
1111
{
12+
/**
13+
* @deprecated php version 7.1 is no longer supported
14+
*/
1215
public static function getForPhp71(array $overriddenRules = []): array
1316
{
1417
return array_merge(self::getBaseRules(), $overriddenRules);
1518
}
1619

20+
/**
21+
* @deprecated php version 7.2 is no longer supported
22+
*/
1723
public static function getForPhp72(array $overriddenRules = []): array
1824
{
1925
$specific72Rules = [
@@ -23,6 +29,9 @@ public static function getForPhp72(array $overriddenRules = []): array
2329
return array_merge(self::getForPhp71($specific72Rules), $overriddenRules);
2430
}
2531

32+
/**
33+
* @deprecated php version 7.3 is no longer supported
34+
*/
2635
public static function getForPhp73(array $overriddenRules = []): array
2736
{
2837
$specific73Rules = [
@@ -39,6 +48,33 @@ public static function getForPhp73(array $overriddenRules = []): array
3948
return array_merge(self::getForPhp72($specific73Rules), $overriddenRules);
4049
}
4150

51+
public static function getForPhp74(array $overriddenRules = []): array
52+
{
53+
$specific74Rules = [
54+
// At the moment there are no specific 7.4 rules or configurations
55+
];
56+
57+
return array_merge(self::getForPhp73($specific74Rules), $overriddenRules);
58+
}
59+
60+
public static function getForPhp80(array $overriddenRules = []): array
61+
{
62+
$specific80Rules = [
63+
// At the moment there are no specific 8.0 rules or configurations
64+
];
65+
66+
return array_merge(self::getForPhp74($specific80Rules), $overriddenRules);
67+
}
68+
69+
public static function getForPhp81(array $overriddenRules = []): array
70+
{
71+
$specific81Rules = [
72+
'declare_strict_types' => true,
73+
];
74+
75+
return array_merge(self::getForPhp80($specific81Rules), $overriddenRules);
76+
}
77+
4278
private static function getBaseRules(): array
4379
{
4480
return [
@@ -97,6 +133,11 @@ private static function getBaseRules(): array
97133
// TODO: Add 'use' when php-cs-fixer #3582 is fixed
98134
],
99135
],
136+
'class_attributes_separation' => [
137+
'elements' => [
138+
'trait_import' => 'none',
139+
],
140+
],
100141
'no_null_property_initialization' => true,
101142
'no_superfluous_elseif' => true,
102143
'no_superfluous_phpdoc_tags' => true,

0 commit comments

Comments
 (0)