1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* (c) 2017 Marcos Sader. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view |
6
|
|
|
* the LICENSE file that was distributed with this source code. |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace xmarcos\PhpCsFixer\Config; |
10
|
|
|
|
11
|
|
|
use PhpCsFixer\Config; |
12
|
|
|
|
13
|
|
|
final class Php56 extends Config |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var null|string |
17
|
|
|
*/ |
18
|
|
|
private $header; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @param null|string $header if a non-empty string is provided, it will be used to enable the header_comment fixer |
22
|
|
|
*/ |
23
|
5 |
|
public function __construct($header = null) |
24
|
|
|
{ |
25
|
5 |
|
parent::__construct("xmarcos' config for PHP v5.6"); |
26
|
|
|
|
27
|
5 |
|
$this->header = $header; |
28
|
|
|
|
29
|
5 |
|
$this->setRiskyAllowed(true); |
30
|
5 |
|
} |
31
|
|
|
|
32
|
3 |
|
public function getRules() |
33
|
|
|
{ |
34
|
|
|
$rules = [ |
35
|
3 |
|
'@PSR2' => true, |
36
|
|
|
'@Symfony' => true, |
37
|
|
|
'array_syntax' => [ |
38
|
|
|
'syntax' => 'short', |
39
|
|
|
], |
40
|
|
|
'binary_operator_spaces' => [ |
41
|
|
|
'align_double_arrow' => true, |
42
|
|
|
'align_equals' => true, |
43
|
|
|
], |
44
|
|
|
'heredoc_to_nowdoc' => true, |
45
|
|
|
'no_null_property_initialization' => true, |
46
|
|
|
'no_short_echo_tag' => true, |
47
|
|
|
'ordered_imports' => true, |
48
|
|
|
'phpdoc_add_missing_param_annotation' => true, |
49
|
|
|
'phpdoc_order' => true, |
50
|
|
|
'phpdoc_types_order' => true, |
51
|
|
|
'strict_comparison' => true, |
52
|
|
|
]; |
53
|
|
|
|
54
|
3 |
|
if (is_string($this->header) && !empty($this->header)) { |
55
|
1 |
|
$rules['header_comment'] = [ |
56
|
1 |
|
'commentType' => 'PHPDoc', |
57
|
1 |
|
'header' => $this->header, |
58
|
1 |
|
'location' => 'after_open', |
59
|
1 |
|
'separate' => 'bottom', |
60
|
|
|
]; |
61
|
|
|
} |
62
|
|
|
|
63
|
3 |
|
return $rules; |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|