Skip to content

Commit d219499

Browse files
authored
Add PHP 8.2 support, drop PHP 8.0 (#19)
1 parent b229ded commit d219499

File tree

9 files changed

+40
-48
lines changed

9 files changed

+40
-48
lines changed

.gitattributes

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/.github export-ignore
2-
/tests export-ignore
3-
.gitattributes export-ignore
4-
.gitignore export-ignore
5-
.php-cs-fixer.php export-ignore
6-
Makefile export-ignore
7-
composer-require-checker.json export-ignore
8-
phpstan.neon export-ignore
9-
phpunit.xml export-ignore
1+
/.github export-ignore
2+
/tests export-ignore
3+
/.gitattributes export-ignore
4+
/.gitignore export-ignore
5+
/.php-cs-fixer.php export-ignore
6+
/Makefile export-ignore
7+
/composer-require-checker.json export-ignore
8+
/phpstan-baseline.neon export-ignore
9+
/phpstan.neon export-ignore
10+
/phpunit.xml export-ignore

.github/workflows/integrate.yaml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
php-version:
18-
- "8.0"
18+
- "8.1"
1919

2020
steps:
2121
- name: "Checkout"
@@ -62,8 +62,8 @@ jobs:
6262
strategy:
6363
matrix:
6464
php-version:
65-
- "8.0"
6665
- "8.1"
66+
- "8.2"
6767

6868
steps:
6969
- name: "Checkout"
@@ -92,15 +92,7 @@ jobs:
9292

9393
- name: "Run tests"
9494
timeout-minutes: 3
95-
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"
96-
97-
- name: "Send code coverage report to Codecov.io"
98-
if: ${{ matrix.php-version == '8.1' }}
99-
uses: codecov/codecov-action@v1
100-
with:
101-
token: ${{ secrets.CODECOV_TOKEN }}
102-
file: ./coverage.xml
103-
fail_ci_if_error: true
95+
run: "make test"
10496

10597
coding-standards:
10698
name: "Coding Standards"
@@ -110,7 +102,7 @@ jobs:
110102
strategy:
111103
matrix:
112104
php-version:
113-
- "8.0"
105+
- "8.1"
114106

115107
steps:
116108
- name: "Checkout"
@@ -147,7 +139,7 @@ jobs:
147139
strategy:
148140
matrix:
149141
php-version:
150-
- "8.0"
142+
- "8.1"
151143

152144
steps:
153145
- name: "Checkout"
@@ -158,7 +150,6 @@ jobs:
158150
with:
159151
coverage: "none"
160152
php-version: "${{ matrix.php-version }}"
161-
tools: cs2pr
162153

163154
- name: "Get composer cache directory"
164155
id: composercache
@@ -175,4 +166,4 @@ jobs:
175166
run: "composer update --no-interaction --no-progress"
176167

177168
- name: "Run static analysis"
178-
run: "vendor/bin/phpstan analyse --no-progress --error-format=checkstyle | cs2pr"
169+
run: "vendor/bin/phpstan analyse --no-progress --error-format=github"

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ all: csfix static-analysis test
33

44
vendor: composer.json
55
composer update
6+
composer bump
67
touch vendor
78

89
.PHONY: csfix
@@ -11,7 +12,7 @@ csfix: vendor
1112

1213
.PHONY: static-analysis
1314
static-analysis: vendor
14-
vendor/bin/phpstan analyse
15+
php -d zend.assertions=1 vendor/bin/phpstan analyse
1516

1617
.PHONY: test
1718
test: vendor

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![Latest Stable Version](https://img.shields.io/packagist/v/slam/php-cs-fixer-extensions.svg)](https://packagist.org/packages/slam/php-cs-fixer-extensions)
44
[![Downloads](https://img.shields.io/packagist/dt/slam/php-cs-fixer-extensions.svg)](https://packagist.org/packages/slam/php-cs-fixer-extensions)
55
[![Integrate](https://github.com/Slamdunk/php-cs-fixer-extensions/workflows/Integrate/badge.svg?branch=master)](https://github.com/Slamdunk/php-cs-fixer-extensions/actions)
6-
[![Code Coverage](https://codecov.io/gh/Slamdunk/php-cs-fixer-extensions/coverage.svg?branch=master)](https://codecov.io/gh/Slamdunk/php-cs-fixer-extensions?branch=master)
76

87
[PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) extensions and configurations
98

composer.json

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@
1010
}
1111
],
1212
"require": {
13-
"php": "~8.0.0 || ~8.1.0",
13+
"php": "~8.1.0 || ~8.2.0",
1414
"ext-mbstring": "*",
1515
"ext-tokenizer": "*",
16-
"friendsofphp/php-cs-fixer": "^3.8.0"
16+
"friendsofphp/php-cs-fixer": "^3.13.2"
1717
},
1818
"require-dev": {
19-
"malukenho/mcbumpface": "^1.1.5",
20-
"phpstan/phpstan": "^1.7.6",
21-
"phpstan/phpstan-phpunit": "^1.1.1",
22-
"phpunit/phpunit": "^9.5.20",
19+
"phpstan/phpstan": "^1.9.6",
20+
"phpstan/phpstan-phpunit": "^1.3.3",
21+
"phpunit/phpunit": "^9.5.27",
2322
"slam/php-debug-r": "^1.7.0",
2423
"slam/phpstan-extensions": "^6.0.0"
2524
},
@@ -32,15 +31,5 @@
3231
"psr-4": {
3332
"SlamCsFixer\\Tests\\": "tests/"
3433
}
35-
},
36-
"config": {
37-
"allow-plugins": {
38-
"malukenho/mcbumpface": true
39-
}
40-
},
41-
"extra": {
42-
"mc-bumpface": {
43-
"stripVersionPrefixes": true
44-
}
4534
}
4635
}

lib/Config.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ final class Config extends PhpCsFixerConfig
2929
'combine_consecutive_unsets' => false,
3030
'comment_to_phpdoc' => false,
3131
'concat_space' => ['spacing' => 'one'],
32+
'control_structure_braces' => true,
3233
'control_structure_continuation_position' => true,
34+
'curly_braces_position' => true,
3335
'date_time_create_from_format_call' => true,
3436
'date_time_immutable' => false,
3537
'declare_parentheses' => true,
@@ -48,6 +50,7 @@ final class Config extends PhpCsFixerConfig
4850
'native_function_invocation' => ['include' => ['@internal']],
4951
'no_blank_lines_before_namespace' => false,
5052
'no_multiline_whitespace_around_double_arrow' => false,
53+
'no_multiple_statements_per_line' => true,
5154
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
5255
'not_operator_with_space' => false,
5356
'not_operator_with_successor_space' => true,
@@ -74,6 +77,7 @@ final class Config extends PhpCsFixerConfig
7477
'simplified_null_return' => false,
7578
'single_line_throw' => false,
7679
'space_after_semicolon' => true,
80+
'statement_indentation' => true,
7781
'static_lambda' => false,
7882
'unary_operator_spaces' => false,
7983
'use_arrow_functions' => false,

phpstan-baseline.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotEmpty\\(\\) with false will always evaluate to false\\.$#"
5+
count: 1
6+
path: tests/ConfigTest.php

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
includes:
22
- vendor/phpstan/phpstan-phpunit/extension.neon
33
- vendor/slam/phpstan-extensions/conf/slam-rules.neon
4+
- phpstan-baseline.neon
45

56
parameters:
67
level: 5

tests/FinalAbstractPublicFixerTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ private static function f6(){}
4141
$fixed = \str_replace('public function', 'final public function', $fixed);
4242

4343
return [
44-
'final-class' => ["<?php final class MyClass { ${original} }"],
45-
'trait' => ["<?php trait MyClass { ${original} }"],
46-
'interface' => ['<?php interface MyClass {
44+
'final-class' => ["<?php final class MyClass { ${original} }"],
45+
'trait' => ["<?php trait MyClass { ${original} }"],
46+
'interface' => ['<?php interface MyClass {
4747
public function f1();
4848
public static function f4();
4949
}'],
50-
'anonymous-class' => ["<?php abstract class MyClass { private function test() { \$a = new class { ${original} }; } }"],
51-
'magic-methods' => ['<?php abstract class MyClass {
50+
'anonymous-class' => ["<?php abstract class MyClass { private function test() { \$a = new class { ${original} }; } }"],
51+
'magic-methods' => ['<?php abstract class MyClass {
5252
public function __construct() {}
5353
public function __destruct() {}
5454
public function __call($a, $b) {}
@@ -69,7 +69,7 @@ public function __debugInfo() {}
6969
abstract public function foo();
7070
abstract protected function bar();
7171
}'],
72-
'abstract-class' => [
72+
'abstract-class' => [
7373
"<?php abstract class MyClass { ${fixed} }",
7474
"<?php abstract class MyClass { ${original} }",
7575
],

0 commit comments

Comments
 (0)