Skip to content

Commit

Permalink
Add PHP 8.2 support, drop PHP 8.0 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Slamdunk authored Jan 4, 2023
1 parent b229ded commit d219499
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 48 deletions.
19 changes: 10 additions & 9 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/.github export-ignore
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php-cs-fixer.php export-ignore
Makefile export-ignore
composer-require-checker.json export-ignore
phpstan.neon export-ignore
phpunit.xml export-ignore
/.github export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.php export-ignore
/Makefile export-ignore
/composer-require-checker.json export-ignore
/phpstan-baseline.neon export-ignore
/phpstan.neon export-ignore
/phpunit.xml export-ignore
21 changes: 6 additions & 15 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.0"
- "8.1"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -62,8 +62,8 @@ jobs:
strategy:
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -92,15 +92,7 @@ jobs:

- name: "Run tests"
timeout-minutes: 3
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"

- name: "Send code coverage report to Codecov.io"
if: ${{ matrix.php-version == '8.1' }}
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
run: "make test"

coding-standards:
name: "Coding Standards"
Expand All @@ -110,7 +102,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.0"
- "8.1"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -147,7 +139,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.0"
- "8.1"

steps:
- name: "Checkout"
Expand All @@ -158,7 +150,6 @@ jobs:
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: cs2pr

- name: "Get composer cache directory"
id: composercache
Expand All @@ -175,4 +166,4 @@ jobs:
run: "composer update --no-interaction --no-progress"

- name: "Run static analysis"
run: "vendor/bin/phpstan analyse --no-progress --error-format=checkstyle | cs2pr"
run: "vendor/bin/phpstan analyse --no-progress --error-format=github"
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ all: csfix static-analysis test

vendor: composer.json
composer update
composer bump
touch vendor

.PHONY: csfix
Expand All @@ -11,7 +12,7 @@ csfix: vendor

.PHONY: static-analysis
static-analysis: vendor
vendor/bin/phpstan analyse
php -d zend.assertions=1 vendor/bin/phpstan analyse

.PHONY: test
test: vendor
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Latest Stable Version](https://img.shields.io/packagist/v/slam/php-cs-fixer-extensions.svg)](https://packagist.org/packages/slam/php-cs-fixer-extensions)
[![Downloads](https://img.shields.io/packagist/dt/slam/php-cs-fixer-extensions.svg)](https://packagist.org/packages/slam/php-cs-fixer-extensions)
[![Integrate](https://github.com/Slamdunk/php-cs-fixer-extensions/workflows/Integrate/badge.svg?branch=master)](https://github.com/Slamdunk/php-cs-fixer-extensions/actions)
[![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)

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

Expand Down
21 changes: 5 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@
}
],
"require": {
"php": "~8.0.0 || ~8.1.0",
"php": "~8.1.0 || ~8.2.0",
"ext-mbstring": "*",
"ext-tokenizer": "*",
"friendsofphp/php-cs-fixer": "^3.8.0"
"friendsofphp/php-cs-fixer": "^3.13.2"
},
"require-dev": {
"malukenho/mcbumpface": "^1.1.5",
"phpstan/phpstan": "^1.7.6",
"phpstan/phpstan-phpunit": "^1.1.1",
"phpunit/phpunit": "^9.5.20",
"phpstan/phpstan": "^1.9.6",
"phpstan/phpstan-phpunit": "^1.3.3",
"phpunit/phpunit": "^9.5.27",
"slam/php-debug-r": "^1.7.0",
"slam/phpstan-extensions": "^6.0.0"
},
Expand All @@ -32,15 +31,5 @@
"psr-4": {
"SlamCsFixer\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"malukenho/mcbumpface": true
}
},
"extra": {
"mc-bumpface": {
"stripVersionPrefixes": true
}
}
}
4 changes: 4 additions & 0 deletions lib/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ final class Config extends PhpCsFixerConfig
'combine_consecutive_unsets' => false,
'comment_to_phpdoc' => false,
'concat_space' => ['spacing' => 'one'],
'control_structure_braces' => true,
'control_structure_continuation_position' => true,
'curly_braces_position' => true,
'date_time_create_from_format_call' => true,
'date_time_immutable' => false,
'declare_parentheses' => true,
Expand All @@ -48,6 +50,7 @@ final class Config extends PhpCsFixerConfig
'native_function_invocation' => ['include' => ['@internal']],
'no_blank_lines_before_namespace' => false,
'no_multiline_whitespace_around_double_arrow' => false,
'no_multiple_statements_per_line' => true,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
'not_operator_with_space' => false,
'not_operator_with_successor_space' => true,
Expand All @@ -74,6 +77,7 @@ final class Config extends PhpCsFixerConfig
'simplified_null_return' => false,
'single_line_throw' => false,
'space_after_semicolon' => true,
'statement_indentation' => true,
'static_lambda' => false,
'unary_operator_spaces' => false,
'use_arrow_functions' => false,
Expand Down
6 changes: 6 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
ignoreErrors:
-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotEmpty\\(\\) with false will always evaluate to false\\.$#"
count: 1
path: tests/ConfigTest.php
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/slam/phpstan-extensions/conf/slam-rules.neon
- phpstan-baseline.neon

parameters:
level: 5
Expand Down
12 changes: 6 additions & 6 deletions tests/FinalAbstractPublicFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ private static function f6(){}
$fixed = \str_replace('public function', 'final public function', $fixed);

return [
'final-class' => ["<?php final class MyClass { ${original} }"],
'trait' => ["<?php trait MyClass { ${original} }"],
'interface' => ['<?php interface MyClass {
'final-class' => ["<?php final class MyClass { ${original} }"],
'trait' => ["<?php trait MyClass { ${original} }"],
'interface' => ['<?php interface MyClass {
public function f1();
public static function f4();
}'],
'anonymous-class' => ["<?php abstract class MyClass { private function test() { \$a = new class { ${original} }; } }"],
'magic-methods' => ['<?php abstract class MyClass {
'anonymous-class' => ["<?php abstract class MyClass { private function test() { \$a = new class { ${original} }; } }"],
'magic-methods' => ['<?php abstract class MyClass {
public function __construct() {}
public function __destruct() {}
public function __call($a, $b) {}
Expand All @@ -69,7 +69,7 @@ public function __debugInfo() {}
abstract public function foo();
abstract protected function bar();
}'],
'abstract-class' => [
'abstract-class' => [
"<?php abstract class MyClass { ${fixed} }",
"<?php abstract class MyClass { ${original} }",
],
Expand Down

0 comments on commit d219499

Please sign in to comment.