Skip to content

Commit f78256e

Browse files
committed
Improved configuration
1 parent 7c75a4f commit f78256e

File tree

3 files changed

+161
-14
lines changed

3 files changed

+161
-14
lines changed

.php_cs

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->files()
5+
->name('*.php')
6+
->in(__DIR__ . '/src')
7+
->in(__DIR__ . '/tests')
8+
;
9+
10+
return PhpCsFixer\Config::create()
11+
->setRules(array(
12+
'@PSR2' => true,
13+
'array_syntax' => ['syntax' => 'short'],
14+
'binary_operator_spaces' => ['align_double_arrow' => false, 'align_equals' => false],
15+
'blank_line_after_namespace' => true,
16+
'blank_line_after_opening_tag' => false,
17+
'blank_line_before_return' => false,
18+
'braces' => ['allow_single_line_closure' => false],
19+
'cast_spaces' => true,
20+
'class_definition' => ['singleLine' => false, 'singleItemSingleLine' => true, 'multiLineExtendsEachSingleLine' => true],
21+
'class_keyword_remove' => false,
22+
'combine_consecutive_unsets' => true,
23+
'concat_space' => false,
24+
'declare_equal_normalize' => ['space' => 'single'],
25+
'declare_strict_types' => false,
26+
'elseif' => true,
27+
'encoding' => true,
28+
'full_opening_tag' => true,
29+
'function_declaration' => true,
30+
'function_typehint_space' => true,
31+
'general_phpdoc_annotation_remove' => ['expectedExceptionMessageRegExp', 'expectedException', 'expectedExceptionMessage'],
32+
'hash_to_slash_comment' => true,
33+
'header_comment' => false,
34+
'heredoc_to_nowdoc' => true,
35+
'include' => true,
36+
'indentation_type' => true,
37+
'line_ending' => true,
38+
'linebreak_after_opening_tag' => true,
39+
'lowercase_cast' => true,
40+
'lowercase_constants' => true,
41+
'lowercase_keywords' => true,
42+
'mb_str_functions' => false,
43+
'method_argument_space' => true,
44+
'method_separation' => true,
45+
'native_function_casing' => true,
46+
'native_function_invocation' => false,
47+
'new_with_braces' => true,
48+
'no_blank_lines_after_class_opening' => true,
49+
'no_blank_lines_after_phpdoc' => false,
50+
'no_blank_lines_before_namespace' => false,
51+
'no_closing_tag' => true,
52+
'no_empty_comment' => true,
53+
'no_empty_phpdoc' => true,
54+
'no_empty_statement' => true,
55+
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
56+
'no_leading_import_slash' => true,
57+
'no_leading_namespace_whitespace' => true,
58+
'no_mixed_echo_print' => ['use' => 'echo'],
59+
'no_multiline_whitespace_around_double_arrow' => true,
60+
'no_multiline_whitespace_before_semicolons' => true,
61+
'no_short_bool_cast' => true,
62+
'no_short_echo_tag' => true,
63+
'no_singleline_whitespace_before_semicolons' => true,
64+
'no_spaces_after_function_name' => true,
65+
'no_spaces_around_offset' => true,
66+
'no_spaces_inside_parenthesis' => true,
67+
'no_trailing_comma_in_list_call' => true,
68+
'no_trailing_comma_in_singleline_array' => true,
69+
'no_trailing_whitespace' => true,
70+
'no_trailing_whitespace_in_comment' => true,
71+
'no_unneeded_control_parentheses' => true,
72+
'no_unused_imports' => true,
73+
'no_useless_else' => true,
74+
'no_useless_return' => true,
75+
'no_whitespace_before_comma_in_array' => true,
76+
'no_whitespace_in_blank_line' => true,
77+
'normalize_index_brace' => true,
78+
'not_operator_with_space' => false,
79+
'not_operator_with_successor_space' => false,
80+
'object_operator_without_whitespace' => true,
81+
'ordered_class_elements' => false,
82+
'ordered_imports' => true,
83+
'php_unit_fqcn_annotation' => true,
84+
'php_unit_strict' => false,
85+
'phpdoc_add_missing_param_annotation' => true,
86+
'phpdoc_align' => true,
87+
'phpdoc_inline_tag' => true,
88+
'phpdoc_no_access' => true,
89+
'phpdoc_no_alias_tag' => ['property-read' => 'property', 'property-write' => 'property', 'type' => 'var'],
90+
'phpdoc_no_empty_return' => true,
91+
'phpdoc_no_package' => true,
92+
'phpdoc_no_useless_inheritdoc' => true,
93+
'phpdoc_order' => true,
94+
'phpdoc_return_self_reference' => true,
95+
'phpdoc_scalar' => true,
96+
'phpdoc_separation' => false,
97+
'phpdoc_single_line_var_spacing' => true,
98+
'phpdoc_summary' => false,
99+
'phpdoc_to_comment' => true,
100+
'phpdoc_trim' => true,
101+
'phpdoc_types' => true,
102+
'phpdoc_var_without_name' => true,
103+
'pow_to_exponentiation' => false,
104+
'pre_increment' => true,
105+
'protected_to_private' => true,
106+
'return_type_declaration' => true,
107+
'self_accessor' => true,
108+
'semicolon_after_instruction' => true,
109+
'short_scalar_cast' => true,
110+
'single_blank_line_at_eof' => true,
111+
'single_blank_line_before_namespace' => false,
112+
'single_class_element_per_statement' => true,
113+
'single_import_per_statement' => true,
114+
'single_line_after_imports' => true,
115+
'single_quote' => true,
116+
'space_after_semicolon' => true,
117+
'standardize_not_equals' => true,
118+
'strict_param' => false,
119+
'switch_case_semicolon_to_colon' => true,
120+
'switch_case_space' => true,
121+
'ternary_operator_spaces' => true,
122+
'ternary_to_null_coalescing' => false,
123+
'trailing_comma_in_multiline_array' => true,
124+
'trim_array_spaces' => true,
125+
'unary_operator_spaces' => true,
126+
'visibility_required' => true,
127+
'whitespace_after_comma_in_array' => true,
128+
))
129+
->setFinder($finder)
130+
;

phpcs.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
<!-- display progress -->
66
<arg value="p"/>
7+
<arg name="report" value="full"/>
78
<arg name="colors"/>
89

910
<!-- coding standard -->

phpunit.xml.dist

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false">
12-
<testsuites>
13-
<testsuite name="All tests">
14-
<directory>tests</directory>
15-
</testsuite>
16-
</testsuites>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
backupGlobals="false"
6+
backupStaticAttributes="false"
7+
beStrictAboutOutputDuringTests="true"
8+
beStrictAboutTestsThatDoNotTestAnything="true"
9+
beStrictAboutTodoAnnotatedTests="true"
10+
colors="true"
11+
verbose="true"
12+
convertErrorsToExceptions="true"
13+
convertNoticesToExceptions="true"
14+
convertWarningsToExceptions="true"
15+
processIsolation="false"
16+
stopOnFailure="false"
17+
failOnWarning="true">
18+
<testsuites>
19+
<testsuite name="TrailingSlash test suite">
20+
<directory>tests</directory>
21+
</testsuite>
22+
</testsuites>
23+
24+
<filter>
25+
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
26+
<directory>./src</directory>
27+
<exclude>
28+
<directory>./tests</directory>
29+
<directory>./vendor</directory>
30+
</exclude>
31+
</whitelist>
32+
</filter>
1733
</phpunit>

0 commit comments

Comments
 (0)