Skip to content

Commit 0f0bb5d

Browse files
committed
Apply more strict php-cs-fixer rules
1 parent d0a777f commit 0f0bb5d

File tree

3 files changed

+81
-3
lines changed

3 files changed

+81
-3
lines changed

.php_cs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,82 @@ $finder = \PhpCsFixer\Finder::create()
77
return \PhpCsFixer\Config::create()
88
->setRules([
99
'@PSR2' => true,
10+
11+
'array_syntax' => ['syntax' => 'short'],
12+
'binary_operator_spaces' => [
13+
'align_equals' => false,
14+
'align_double_arrow' => null,
15+
],
16+
'blank_line_after_opening_tag' => true,
17+
'cast_spaces' => true,
18+
'concat_space' => ['spacing' => 'one'],
19+
'declare_equal_normalize' => true,
20+
'dir_constant' => true,
21+
'ereg_to_preg' => true,
22+
'function_typehint_space' => true,
23+
'hash_to_slash_comment' => true,
24+
'heredoc_to_nowdoc' => true,
25+
'include' => true,
26+
'lowercase_cast' => true,
27+
'method_separation' => true,
28+
'modernize_types_casting' => true,
29+
'native_function_casing' => true,
30+
'new_with_braces' => true,
31+
'no_alias_functions' => true,
32+
'no_blank_lines_after_class_opening' => true,
33+
'no_blank_lines_after_phpdoc' => true,
34+
'no_empty_comment' => true,
35+
'no_empty_phpdoc' => true,
36+
'no_empty_statement' => true,
37+
'no_extra_consecutive_blank_lines' => true,
38+
'no_leading_import_slash' => true,
39+
'no_leading_namespace_whitespace' => true,
40+
'no_mixed_echo_print' => true,
41+
'no_multiline_whitespace_around_double_arrow' => true,
42+
'no_php4_constructor' => true,
43+
'no_short_bool_cast' => true,
44+
'no_singleline_whitespace_before_semicolons' => true,
45+
'no_spaces_around_offset' => true,
46+
'no_trailing_comma_in_list_call' => true,
47+
'no_trailing_comma_in_singleline_array' => true,
48+
'no_unneeded_control_parentheses' => true,
49+
'no_unused_imports' => true,
50+
'no_useless_return' => true,
51+
'no_whitespace_before_comma_in_array' => true,
52+
'no_whitespace_in_blank_line' => true,
53+
'normalize_index_brace' => true,
54+
'object_operator_without_whitespace' => true,
55+
'ordered_imports' => true,
56+
'php_unit_construct' => true,
57+
'php_unit_dedicate_assert' => true,
58+
'php_unit_strict' => true,
59+
'phpdoc_add_missing_param_annotation' => true,
60+
'phpdoc_annotation_without_dot' => true,
61+
'phpdoc_indent' => true,
62+
'phpdoc_inline_tag' => true,
63+
'phpdoc_no_access' => true,
64+
'phpdoc_no_alias_tag' => true,
65+
'phpdoc_no_package' => true,
66+
'phpdoc_scalar' => true,
67+
'phpdoc_single_line_var_spacing' => true,
68+
'phpdoc_summary' => true,
69+
'phpdoc_trim' => true,
70+
'phpdoc_types' => true,
71+
'phpdoc_var_without_name' => true,
72+
'pow_to_exponentiation' => true,
73+
'psr4' => true,
74+
'return_type_declaration' => true,
75+
'self_accessor' => true,
76+
'short_scalar_cast' => true,
77+
'single_blank_line_before_namespace' => true,
78+
'single_quote' => true,
79+
'space_after_semicolon' => true,
80+
'standardize_not_equals' => true,
81+
'strict_comparison' => true,
82+
'strict_param' => true,
83+
'ternary_operator_spaces' => true,
84+
'trailing_comma_in_multiline_array' => true,
85+
'trim_array_spaces' => true,
86+
'whitespace_after_comma_in_array' => true,
1087
])
1188
->setFinder($finder);

src/JsonStream.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function isSeekable()
134134
* encoding the entire value, it's not possible to set the cursor using SEEK_END
135135
* constant and doing so will result in an exception.
136136
*
137-
* @param int $offset The offset for the cursor.
137+
* @param int $offset The offset for the cursor
138138
* @param int $whence Either SEEK_CUR or SEEK_SET to determine new cursor position
139139
*/
140140
public function seek($offset, $whence = SEEK_SET)
@@ -171,7 +171,7 @@ private function calculatePosition($offset, $whence)
171171

172172
/**
173173
* Forwards the JSON stream reading cursor to the given position or to the end of stream.
174-
* @param int $position The new position of the cursor.
174+
* @param int $position The new position of the cursor
175175
*/
176176
private function forward($position)
177177
{
@@ -304,7 +304,7 @@ public function getContents()
304304
* As no underlying PHP stream exists for the JSON stream, this method will
305305
* always return an empty array or a null.
306306
*
307-
* @param string|null The key of the value to return
307+
* @param string|null $key The key of the value to return
308308
* @return array|null Always returns an empty array or a null
309309
*/
310310
public function getMetadata($key = null)

tests/tests/JsonEncoderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ public function testNullOnInvalid()
144144
}
145145

146146
/**
147+
* @param mixed $value The value to encode
147148
* @dataProvider getSimpleTestValues
148149
*/
149150
public function testSimpleValues($value)

0 commit comments

Comments
 (0)