Skip to content

Commit be7de5d

Browse files
committed
[TASK] Add more PHP-CS-Fixer rules and autoformat the code
1 parent 8f2ba48 commit be7de5d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+164
-5
lines changed

bin/quickdump.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env php
22
<?php
33

4+
declare(strict_types=1);
5+
46
/**
57
* This script is used for generating the examples in the README.
68
*/

config/php-cs-fixer.php

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,76 @@
2222
// overwrite the PER2 defaults to restore compatibility with PHP 7.x
2323
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
2424

25-
// for `in_array` & friends
26-
'strict_param' => true,
25+
// casing
26+
'magic_constant_casing' => true,
27+
'native_function_casing' => true,
28+
29+
// cast notation
30+
'modernize_types_casting' => true,
31+
'no_short_bool_cast' => true,
32+
33+
// class notation
34+
'no_php4_constructor' => true,
35+
36+
// comment
37+
'no_empty_comment' => true,
38+
39+
// control structure
40+
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
41+
42+
// function notation
43+
'native_function_invocation' => ['include' => ['@all']],
44+
45+
// import
46+
'no_unused_imports' => true,
47+
48+
// language construct
49+
'combine_consecutive_issets' => true,
50+
'combine_consecutive_unsets' => true,
51+
'dir_constant' => true,
52+
'is_null' => true,
53+
54+
// namespace notation
55+
'no_leading_namespace_whitespace' => true,
2756

57+
// operator
58+
'standardize_not_equals' => true,
59+
'ternary_to_null_coalescing' => true,
60+
61+
// PHP tag
62+
'linebreak_after_opening_tag' => true,
63+
64+
// PHPUnit
2865
'php_unit_construct' => true,
2966
'php_unit_dedicate_assert' => ['target' => 'newest'],
3067
'php_unit_expectation' => ['target' => 'newest'],
3168
'php_unit_fqcn_annotation' => true,
32-
'php_unit_method_casing' => true,
33-
'php_unit_mock' => ['target' => 'newest'],
3469
'php_unit_mock_short_will_return' => true,
35-
'php_unit_namespaced' => ['target' => 'newest'],
3670
'php_unit_set_up_tear_down_visibility' => true,
3771
'php_unit_test_annotation' => ['style' => 'annotation'],
3872
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
73+
74+
// PHPDoc
75+
'no_blank_lines_after_phpdoc' => true,
76+
'no_empty_phpdoc' => true,
77+
'phpdoc_indent' => true,
78+
'phpdoc_no_package' => true,
79+
'phpdoc_trim' => true,
80+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
81+
82+
// return notation
83+
'no_useless_return' => true,
84+
85+
// semicolon
86+
'no_empty_statement' => true,
87+
'no_singleline_whitespace_before_semicolons' => true,
88+
'semicolon_after_instruction' => true,
89+
90+
// strict
91+
'declare_strict_types' => true,
92+
'strict_param' => true,
93+
94+
// string notation
95+
'string_implicit_backslashes' => ['single_quoted' => 'escape'],
3996
]
4097
);

src/CSSList/AtRuleBlockList.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\CSSList;
46

57
use Sabberworm\CSS\OutputFormat;

src/CSSList/CSSBlockList.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\CSSList;
46

57
use Sabberworm\CSS\Property\Selector;

src/CSSList/CSSList.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\CSSList;
46

57
use Sabberworm\CSS\Comment\Comment;

src/CSSList/Document.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\CSSList;
46

57
use Sabberworm\CSS\OutputFormat;

src/CSSList/KeyFrame.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\CSSList;
46

57
use Sabberworm\CSS\OutputFormat;

src/Comment/Comment.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Comment;
46

57
use Sabberworm\CSS\OutputFormat;

src/Comment/Commentable.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Comment;
46

57
interface Commentable

src/OutputFormat.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS;
46

57
/**

src/OutputFormatter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS;
46

57
use Sabberworm\CSS\Comment\Commentable;

src/Parser.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS;
46

57
use Sabberworm\CSS\CSSList\Document;

src/Parsing/Anchor.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Parsing;
46

57
class Anchor

src/Parsing/OutputException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Parsing;
46

57
/**

src/Parsing/ParserState.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Parsing;
46

57
use Sabberworm\CSS\Comment\Comment;

src/Parsing/SourceException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Parsing;
46

57
class SourceException extends \Exception

src/Parsing/UnexpectedEOFException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Parsing;
46

57
/**

src/Parsing/UnexpectedTokenException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Parsing;
46

57
/**

src/Property/AtRule.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Property;
46

57
use Sabberworm\CSS\Comment\Commentable;

src/Property/CSSNamespace.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Property;
46

57
use Sabberworm\CSS\Comment\Comment;

src/Property/Charset.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Property;
46

57
use Sabberworm\CSS\Comment\Comment;

src/Property/Import.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Property;
46

57
use Sabberworm\CSS\Comment\Comment;

src/Property/KeyframeSelector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Property;
46

57
class KeyframeSelector extends Selector

src/Property/Selector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Property;
46

57
/**

src/Renderable.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS;
46

57
interface Renderable

src/Rule/Rule.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Rule;
46

57
use Sabberworm\CSS\Comment\Comment;

src/RuleSet/AtRuleSet.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\RuleSet;
46

57
use Sabberworm\CSS\OutputFormat;

src/RuleSet/DeclarationBlock.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\RuleSet;
46

57
use Sabberworm\CSS\CSSList\CSSList;

src/RuleSet/RuleSet.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\RuleSet;
46

57
use Sabberworm\CSS\Comment\Comment;

src/Settings.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS;
46

57
/**

src/Value/CSSFunction.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Value;
46

57
use Sabberworm\CSS\OutputFormat;

src/Value/CSSString.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Value;
46

57
use Sabberworm\CSS\OutputFormat;

src/Value/CalcFunction.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Value;
46

57
use Sabberworm\CSS\Parsing\ParserState;

src/Value/CalcRuleValueList.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Value;
46

57
use Sabberworm\CSS\OutputFormat;

src/Value/Color.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Value;
46

57
use Sabberworm\CSS\OutputFormat;

src/Value/LineName.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Value;
46

57
use Sabberworm\CSS\OutputFormat;

src/Value/PrimitiveValue.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Value;
46

57
abstract class PrimitiveValue extends Value

src/Value/RuleValueList.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Value;
46

57
/**

src/Value/Size.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Value;
46

57
use Sabberworm\CSS\OutputFormat;

src/Value/URL.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Sabberworm\CSS\Value;
46

57
use Sabberworm\CSS\OutputFormat;

0 commit comments

Comments
 (0)