Skip to content

Commit 16753ea

Browse files
Merge pull request #17 from M6Web/feat/fixed-dependencies
Single version and cs-fixer 3.0
2 parents d4be195 + 9254b18 commit 16753ea

File tree

7 files changed

+80
-19
lines changed

7 files changed

+80
-19
lines changed

README.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,32 @@ $ composer require --dev m6web/php-cs-fixer-config
1414

1515
### Configuration
1616

17-
Create a configuration file `.php_cs` in the root of your project:
17+
Create a configuration file `.php-cs-fixer.dist.php` in the root of your project:
1818

1919
```php
2020
<?php
2121

22-
$config = new M6Web\CS\Config\Php72;
22+
$finder = PhpCsFixer\Finder::create()
23+
->in(
24+
[
25+
__DIR__.'/src',
26+
__DIR__.'/tests',
27+
]
28+
);
2329

24-
$config->getFinder()
25-
->in([
26-
__DIR__.'/src'
27-
])->exclude([
28-
'Tests'
29-
]);
30+
$config = new M6Web\CS\Config\BedrockStreaming();
31+
$config->setFinder($finder);
3032

3133
return $config;
3234
```
3335

3436
### Git
3537

36-
Add `.php_cs.cache` (this is the cache file created by `php-cs-fixer`) to `.gitignore`:
38+
Add `.php-cs-fixer.cache` (this is the cache file created by `php-cs-fixer`) to `.gitignore`:
3739

3840
```
3941
vendor/
40-
.php_cs.cache
42+
.php-cs-fixer.cache
4143
```
4244

4345
### Makefile
@@ -81,7 +83,7 @@ $ make cs-ci
8183
8284
## Credits
8385
84-
Developed by [M6Web](http://tech.m6web.fr/), inspired by [refinery29/php-cs-fixer-config](https://github.com/refinery29/php-cs-fixer-config).
86+
Developed by [Bedrock Streaming](https://tech.bedrockstreaming.com), inspired by [refinery29/php-cs-fixer-config](https://github.com/refinery29/php-cs-fixer-config).
8587
8688
## License
8789

composer.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
"license": "MIT",
77
"authors": [
88
{
9-
"name": "M6Web",
10-
"email": "opensource@m6web.fr",
11-
"homepage": "http://tech.m6web.fr/"
9+
"name": "Bedrock",
10+
"email": "opensource@bedrockstreaming.com",
11+
"homepage": "https://tech.bedrockstreaming.com/"
1212
}
1313
],
1414
"require": {
15-
"friendsofphp/php-cs-fixer": "^2.16.1"
15+
"php": "^7.1.3 || ^8.0",
16+
"friendsofphp/php-cs-fixer": "^3.0"
1617
},
1718
"autoload": {
1819
"psr-4": {

src/BedrockStreaming.php

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
namespace M6Web\CS\Config;
4+
5+
use PhpCsFixer\Config;
6+
7+
final class BedrockStreaming extends Config
8+
{
9+
public function __construct()
10+
{
11+
parent::__construct('Bedrock Streaming');
12+
13+
$this->setRiskyAllowed(true);
14+
}
15+
16+
public function getRules(): array
17+
{
18+
$rules = [
19+
'@Symfony' => true,
20+
'array_syntax' => [
21+
'syntax' => 'short',
22+
],
23+
'braces' => [
24+
'allow_single_line_closure' => true,
25+
],
26+
'global_namespace_import' => [
27+
'import_classes' => false,
28+
'import_constants' => false,
29+
'import_functions' => false,
30+
],
31+
'heredoc_to_nowdoc' => false,
32+
'increment_style' => ['style' => 'post'],
33+
'no_unreachable_default_argument_value' => false,
34+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
35+
'phpdoc_line_span' => [
36+
'property' => 'single',
37+
'const' => 'single',
38+
],
39+
'phpdoc_summary' => false,
40+
'single_line_throw' => false,
41+
'yoda_style' => false,
42+
];
43+
44+
return $rules;
45+
}
46+
}

src/Php71.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
use PhpCsFixer\Config;
66

7+
/**
8+
* @deprecated Use M6Web\CS\Config\BedrockStreaming
9+
*/
710
final class Php71 extends Config
811
{
912
public function __construct()
@@ -13,7 +16,7 @@ public function __construct()
1316
$this->setRiskyAllowed(true);
1417
}
1518

16-
public function getRules()
19+
public function getRules(): array
1720
{
1821
$rules = [
1922
'@Symfony' => true,

src/Php72.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
use PhpCsFixer\Config;
66

7+
/**
8+
* @deprecated Use M6Web\CS\Config\BedrockStreaming
9+
*/
710
final class Php72 extends Config
811
{
912
public function __construct()
@@ -13,7 +16,7 @@ public function __construct()
1316
$this->setRiskyAllowed(true);
1417
}
1518

16-
public function getRules()
19+
public function getRules(): array
1720
{
1821
$rules = [
1922
'@Symfony' => true,

src/Php73.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
use PhpCsFixer\Config;
66

7+
/**
8+
* @deprecated Use M6Web\CS\Config\BedrockStreaming
9+
*/
710
final class Php73 extends Config
811
{
912
public function __construct()
@@ -13,7 +16,7 @@ public function __construct()
1316
$this->setRiskyAllowed(true);
1417
}
1518

16-
public function getRules()
19+
public function getRules(): array
1720
{
1821
$rules = [
1922
'@Symfony' => true,

src/Php74.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
use PhpCsFixer\Config;
66

7+
/**
8+
* @deprecated Use M6Web\CS\Config\BedrockStreaming
9+
*/
710
final class Php74 extends Config
811
{
912
public function __construct()
@@ -13,7 +16,7 @@ public function __construct()
1316
$this->setRiskyAllowed(true);
1417
}
1518

16-
public function getRules()
19+
public function getRules(): array
1720
{
1821
$rules = [
1922
'@Symfony' => true,

0 commit comments

Comments
 (0)