Skip to content

Commit

Permalink
Merge pull request #17 from M6Web/feat/fixed-dependencies
Browse files Browse the repository at this point in the history
Single version and cs-fixer 3.0
  • Loading branch information
valentin-claras committed Aug 24, 2021
2 parents d4be195 + 9254b18 commit 16753ea
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 19 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,32 @@ $ composer require --dev m6web/php-cs-fixer-config

### Configuration

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

```php
<?php

$config = new M6Web\CS\Config\Php72;
$finder = PhpCsFixer\Finder::create()
->in(
[
__DIR__.'/src',
__DIR__.'/tests',
]
);

$config->getFinder()
->in([
__DIR__.'/src'
])->exclude([
'Tests'
]);
$config = new M6Web\CS\Config\BedrockStreaming();
$config->setFinder($finder);

return $config;
```

### Git

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

```
vendor/
.php_cs.cache
.php-cs-fixer.cache
```

### Makefile
Expand Down Expand Up @@ -81,7 +83,7 @@ $ make cs-ci
## Credits
Developed by [M6Web](http://tech.m6web.fr/), inspired by [refinery29/php-cs-fixer-config](https://github.com/refinery29/php-cs-fixer-config).
Developed by [Bedrock Streaming](https://tech.bedrockstreaming.com), inspired by [refinery29/php-cs-fixer-config](https://github.com/refinery29/php-cs-fixer-config).
## License
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
"license": "MIT",
"authors": [
{
"name": "M6Web",
"email": "opensource@m6web.fr",
"homepage": "http://tech.m6web.fr/"
"name": "Bedrock",
"email": "opensource@bedrockstreaming.com",
"homepage": "https://tech.bedrockstreaming.com/"
}
],
"require": {
"friendsofphp/php-cs-fixer": "^2.16.1"
"php": "^7.1.3 || ^8.0",
"friendsofphp/php-cs-fixer": "^3.0"
},
"autoload": {
"psr-4": {
Expand Down
46 changes: 46 additions & 0 deletions src/BedrockStreaming.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace M6Web\CS\Config;

use PhpCsFixer\Config;

final class BedrockStreaming extends Config
{
public function __construct()
{
parent::__construct('Bedrock Streaming');

$this->setRiskyAllowed(true);
}

public function getRules(): array
{
$rules = [
'@Symfony' => true,
'array_syntax' => [
'syntax' => 'short',
],
'braces' => [
'allow_single_line_closure' => true,
],
'global_namespace_import' => [
'import_classes' => false,
'import_constants' => false,
'import_functions' => false,
],
'heredoc_to_nowdoc' => false,
'increment_style' => ['style' => 'post'],
'no_unreachable_default_argument_value' => false,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'phpdoc_line_span' => [
'property' => 'single',
'const' => 'single',
],
'phpdoc_summary' => false,
'single_line_throw' => false,
'yoda_style' => false,
];

return $rules;
}
}
5 changes: 4 additions & 1 deletion src/Php71.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use PhpCsFixer\Config;

/**
* @deprecated Use M6Web\CS\Config\BedrockStreaming
*/
final class Php71 extends Config
{
public function __construct()
Expand All @@ -13,7 +16,7 @@ public function __construct()
$this->setRiskyAllowed(true);
}

public function getRules()
public function getRules(): array
{
$rules = [
'@Symfony' => true,
Expand Down
5 changes: 4 additions & 1 deletion src/Php72.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use PhpCsFixer\Config;

/**
* @deprecated Use M6Web\CS\Config\BedrockStreaming
*/
final class Php72 extends Config
{
public function __construct()
Expand All @@ -13,7 +16,7 @@ public function __construct()
$this->setRiskyAllowed(true);
}

public function getRules()
public function getRules(): array
{
$rules = [
'@Symfony' => true,
Expand Down
5 changes: 4 additions & 1 deletion src/Php73.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use PhpCsFixer\Config;

/**
* @deprecated Use M6Web\CS\Config\BedrockStreaming
*/
final class Php73 extends Config
{
public function __construct()
Expand All @@ -13,7 +16,7 @@ public function __construct()
$this->setRiskyAllowed(true);
}

public function getRules()
public function getRules(): array
{
$rules = [
'@Symfony' => true,
Expand Down
5 changes: 4 additions & 1 deletion src/Php74.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use PhpCsFixer\Config;

/**
* @deprecated Use M6Web\CS\Config\BedrockStreaming
*/
final class Php74 extends Config
{
public function __construct()
Expand All @@ -13,7 +16,7 @@ public function __construct()
$this->setRiskyAllowed(true);
}

public function getRules()
public function getRules(): array
{
$rules = [
'@Symfony' => true,
Expand Down

0 comments on commit 16753ea

Please sign in to comment.