Skip to content

Commit f006cb0

Browse files
committed
Configure rules for PHP 7.4, 8.0 and 8.1
1 parent c817f0c commit f006cb0

File tree

16 files changed

+193
-205
lines changed

16 files changed

+193
-205
lines changed

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
/.editorconfig export-ignore
55
/.gitattributes export-ignore
66
/.gitignore export-ignore
7-
/.php-cs-fixer.php export-ignore
8-
/phpstan.neon.dist export-ignore
7+
/.php-cs-fixer.dist.php export-ignore

.github/workflows/tests.yml

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

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
/vendor/
22

33
/.php-cs-fixer.cache
4-
/.phpunit.result.cache
5-
64
/composer.lock
7-
/phpstan.neon
8-
/phpunit.xml

.php-cs-fixer.dist.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Beste\PhpCsFixer\Config;
6+
use Ergebnis\PhpCsFixer\Config\Factory;
7+
8+
$config = Factory::fromRuleSet(new Config\RuleSet\Php81());
9+
10+
$config
11+
->getFinder()
12+
->in(__DIR__)
13+
->ignoreDotFiles(false);
14+
15+
return $config;

.php-cs-fixer.php

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

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# CHANGELOG
2+
3+
## [Unreleased]
4+
5+
## [1.0.0] - 2022-08-25
6+
7+
* Rules extend the Ergebnis rules with the following modifications:
8+
* `blank_line_between_import_groups`: Blank lines are put between import groups
9+
* `global_namespace_import`: classes and functions are imported
10+
* `phpdoc_align`: PHPDoc items are left-aligned
11+
* `phpdoc_types_order`: types are not sorted, `null` is always last
12+
* `php_unit_test_class_requires_covers`: Tests don't require `@covers` annotations
13+
* `yoda_style`: Condition styles are not enforced
14+
15+
[Unreleased]: https://github.com/beste/php-cs-fixer-config/compare/1.0.0...main
16+
[1.0.0]: https://github.com/beste/php-cs-fixer-config/tree/1.0.0

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1-
# PHP CS Fixer Config
1+
# BESTE PHP CS Fixer Config
22

3-
PHP CS Fixer Config used in BESTE projects
3+
PHP CS Fixer Config used in BESTE projects, based on
4+
[`ergebnis/php-cs-fixer-config`](https://github.com/ergebnis/php-cs-fixer-config).
45

56
## Installation
67

78
```shell
8-
composer require beste/php-cs-fixer-config
9+
composer require --dev beste/php-cs-fixer-config
910
```
1011

11-
## Running tests
12+
## Usage
1213

13-
```shell
14-
composer run tests
15-
```
14+
Detailed usage instructions can be found in the
15+
[README of `ergebnis/php-cs-fixer-config`](https://github.com/ergebnis/php-cs-fixer-config/blob/main/README.md).
16+
17+
### Available configurations
18+
19+
* [`Beste\PhpCsFixer\Config\RuleSet\Php74`](src/Config/RuleSet/Php74.php)
20+
* [`Beste\PhpCsFixer\Config\RuleSet\Php80`](src/Config/RuleSet/Php80.php)
21+
* [`Beste\PhpCsFixer\Config\RuleSet\Php81`](src/Config/RuleSet/Php81.php)
22+
23+
## Changelog
24+
25+
Please have a look at [`CHANGELOG.md`](CHANGELOG.md).
26+
27+
## Credits
28+
29+
This project extends [`ergebnis/php-cs-fixer-config`](https://github.com/ergebnis/php-cs-fixer-config).

composer.json

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,15 @@
1010
}
1111
],
1212
"require": {
13-
"php": "~8.0.0 || ~8.1.0"
14-
},
15-
"require-dev": {
16-
"ergebnis/composer-normalize": "^2.28",
17-
"ergebnis/php-cs-fixer-config": "^4.4",
18-
"ergebnis/phpstan-rules": "^1.0",
19-
"phpstan/extension-installer": "^1.1",
20-
"phpstan/phpstan": "^1.8",
21-
"phpstan/phpstan-deprecation-rules": "^1.0",
22-
"phpstan/phpstan-phpunit": "^1.1.1",
23-
"phpstan/phpstan-strict-rules": "^1.3.0",
24-
"phpunit/phpunit": "^9.5"
13+
"php": "^8.1",
14+
"ergebnis/php-cs-fixer-config": "^4.7"
2515
},
2616
"autoload": {
2717
"psr-4": {
2818
"Beste\\PhpCsFixer\\": "src"
2919
}
3020
},
31-
"autoload-dev": {
32-
"psr-4": {
33-
"Beste\\PhpCsFixer\\Tests\\": "tests"
34-
}
35-
},
36-
"config": {
37-
"allow-plugins": {
38-
"phpstan/extension-installer": true,
39-
"composer/package-versions-deprecated": true,
40-
"ergebnis/composer-normalize": true
41-
},
42-
"sort-packages": true
43-
},
4421
"scripts": {
45-
"cs": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose",
46-
"phpstan": "vendor/bin/phpstan analyse",
47-
"phpunit": "vendor/bin/phpunit",
48-
"test": [
49-
"@phpstan",
50-
"@phpunit"
51-
]
52-
},
53-
"scripts-descriptions": {
54-
"cs": "Applies coding standards",
55-
"phpstan": "Runs static analysis with PHPStan",
56-
"phpunit": "Runs tests with PHPUnit",
57-
"test": "Runs static analysis and test suites"
22+
"cs": "vendor/bin/php-cs-fixer fix --diff --verbose"
5823
}
5924
}

phpstan.neon.dist

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

phpunit.xml.dist

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

0 commit comments

Comments
 (0)