Skip to content

Commit

Permalink
Disallow useless string concatenation (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
MidnightDesign authored Jul 9, 2024
1 parent 43b50e0 commit 1ce8bfe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Eventjet/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@
<!-- Forbid `$this` inside static function -->
<rule ref="Squiz.Scope.StaticThisUsage"/>

<!-- Force whitespace before and after concatenation -->
<!-- String concatenation -->
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1"/>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>

<!-- Forbid spaces in type casts -->
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
Expand Down
1 change: 1 addition & 0 deletions php-cs-fixer-rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
'no_trailing_comma_in_singleline' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_concat_operator' => true,
'nullable_type_declaration_for_default_null_value' => true,
'ordered_imports' => [
'imports_order' => ['class', 'function', 'const'],
Expand Down
5 changes: 5 additions & 0 deletions tests/fixtures/invalid/useless-concat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

declare(strict_types=1);

echo 'a' . 'b';

0 comments on commit 1ce8bfe

Please sign in to comment.