Skip to content

Commit

Permalink
Merge pull request #13 from M6Web/feature/php-new-version
Browse files Browse the repository at this point in the history
Support for php 7.2/7.3
  • Loading branch information
b-viguier committed Jan 25, 2019
2 parents 8737cf9 + e92266e commit fc6bd97
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Create a configuration file `.php_cs` in the root of your project:
```php
<?php

$config = new M6Web\CS\Config\Php71;
$config = new M6Web\CS\Config\Php72;

$config->getFinder()
->in([
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
],
"require": {
"friendsofphp/php-cs-fixer": "~2.13.0"
"friendsofphp/php-cs-fixer": "^2.14"
},
"autoload": {
"psr-4": {
Expand Down
36 changes: 36 additions & 0 deletions src/Php72.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace M6Web\CS\Config;

use PhpCsFixer\Config;

final class Php72 extends Config
{
public function __construct()
{
parent::__construct('M6Web (PHP 7.2)');

$this->setRiskyAllowed(true);
}

public function getRules()
{
$rules = [
'@Symfony' => true,
'array_syntax' => [
'syntax' => 'short',
],
'no_unreachable_default_argument_value' => false,
'braces' => [
'allow_single_line_closure' => true,
],
'heredoc_to_nowdoc' => false,
'phpdoc_summary' => false,
'increment_style' => ['style' => 'post'],
'yoda_style' => false,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
];

return $rules;
}
}
36 changes: 36 additions & 0 deletions src/Php73.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace M6Web\CS\Config;

use PhpCsFixer\Config;

final class Php73 extends Config
{
public function __construct()
{
parent::__construct('M6Web (PHP 7.3)');

$this->setRiskyAllowed(true);
}

public function getRules()
{
$rules = [
'@Symfony' => true,
'array_syntax' => [
'syntax' => 'short',
],
'no_unreachable_default_argument_value' => false,
'braces' => [
'allow_single_line_closure' => true,
],
'heredoc_to_nowdoc' => false,
'phpdoc_summary' => false,
'increment_style' => ['style' => 'post'],
'yoda_style' => false,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
];

return $rules;
}
}

0 comments on commit fc6bd97

Please sign in to comment.