Skip to content

Commit 1f90878

Browse files
committed
updated rules
SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly: disabled because it enforces `use` statements in the global code
1 parent 560c193 commit 1f90878

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"license": "MIT",
44
"require": {
55
"php": "^8.0",
6-
"slevomat/coding-standard": "^8.15",
6+
"slevomat/coding-standard": "^8.15.x-dev",
77
"friendsofphp/php-cs-fixer": "^3.68",
88
"squizlabs/php_codesniffer": "^3.11",
99
"kubawerlos/php-cs-fixer-custom-fixers": "^3.22"

preset-fixer/common/Nette.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55
return [
66
'@PSR12' => true,
77
'@PSR12:risky' => true,
8-
'new_with_braces' => false, // new stdClass
8+
'new_with_parentheses' => false, // new stdClass
99
'single_line_after_imports' => false, // Nette uses two empty lines
1010
'blank_line_after_namespace' => false,
1111
'ordered_imports' => true, // Use statements are alphabetically ordered
1212
'blank_line_between_import_groups' => false,
1313

14-
// braces split
15-
'braces' => false,
1614
// Ensures a single space after language constructs
17-
'single_space_after_construct' => true,
15+
'single_space_around_construct' => true,
1816
// The body of each control structure MUST be enclosed within braces
1917
'control_structure_braces' => true,
2018
// Control structure continuation keyword must be on the configured line
@@ -37,7 +35,7 @@
3735

3836
// Each statement must be indented
3937
'statement_indentation' => false,
40-
'Nette/statement_indentation' => true,
38+
'Nette/statement_indentation' => ['stick_comment_to_next_continuous_control_statement' => true],
4139

4240
// In the argument list, there must be one space after each comma, and there must no be a space before each comma
4341
'method_argument_space' => false,
@@ -108,7 +106,8 @@
108106
// Remove useless semicolon statements
109107
'no_empty_statement' => true,
110108

111-
'no_unneeded_curly_braces' => true,
109+
// Removes unneeded braces that are superfluous and aren’t part of a control structure’s body
110+
'no_unneeded_braces' => true,
112111

113112
// Remove trailing commas in list() calls.
114113
'no_trailing_comma_in_singleline' => true,
@@ -166,7 +165,8 @@
166165
// Convert double quotes to single quotes for simple strings.
167166
'single_quote' => true,
168167

169-
'escape_implicit_backslashes' => true,
168+
// Handles implicit backslashes in strings and heredocs
169+
'string_implicit_backslashes' => true,
170170

171171
// Convert ${..} to {$..}
172172
'simple_to_complex_string_variable' => true,

preset-sniffer/Nette.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ https://github.com/slevomat/coding-standard
254254
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
255255
<rule ref="SlevomatCodingStandard.Namespaces.MultipleUsesPerLine"/>
256256
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
257-
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFallbackGlobalName"/>
258257
<properties>
258+
<property name="allowWhenNoNamespace" value="false"/>
259259
<property name="allowFallbackGlobalConstants" value="true"/>
260260
<property name="allowFallbackGlobalFunctions" value="true"/>
261261
<property name="allowFullyQualifiedGlobalClasses" value="true"/>

0 commit comments

Comments
 (0)