Skip to content

Commit 09407d4

Browse files
committed
Force a space after '!'
1 parent 091371e commit 09407d4

13 files changed

+24
-27
lines changed

src/Unleashed/ruleset.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,8 @@
5555
<property name="spacing" value="1"/>
5656
</properties>
5757
</rule>
58-
<!-- Force no whitespace after `!` -->
59-
<rule ref="Generic.Formatting.SpaceAfterNot">
60-
<properties>
61-
<property name="spacing" value="0" />
62-
</properties>
63-
</rule>
58+
<!-- Force whitespace after `!` -->
59+
<rule ref="Generic.Formatting.SpaceAfterNot"/>
6460
<!-- Forbid PHP 4 constructors -->
6561
<rule ref="Generic.NamingConventions.ConstructorName"/>
6662
<!-- Forbid any content before opening tag -->

tests/fixed/EarlyReturn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function bar(): bool
1414
public function foo(): ?string
1515
{
1616
foreach ($itens as $item) {
17-
if (!$item->isItem()) {
17+
if (! $item->isItem()) {
1818
return 'There is an item that is not an item';
1919
}
2020

tests/fixed/UselessConditions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function necessaryIfConditionWithMethodCall(): bool
9494

9595
public function nullShouldNotBeTreatedAsFalse(): ?bool
9696
{
97-
if (!$this->isAdmin) {
97+
if (! $this->isAdmin) {
9898
return null;
9999
}
100100

tests/fixed/example-class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function isBaz(): bool
6868
*/
6969
public function mangleBar(int $length): void
7070
{
71-
if (!$this->baz) {
71+
if (! $this->baz) {
7272
throw new \InvalidArgumentException();
7373
}
7474

tests/fixed/not_spacing.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66

77
$test++;
88

9-
if (!$test > 0) {
9+
if (! $test > 0) {
1010
echo 1;
11-
} elseif (!$test === 0) {
11+
} elseif (! $test === 0) {
1212
echo 0;
1313
} else {
1414
echo -1;
1515
}
1616

17-
while (!true) {
17+
while (! true) {
1818
echo 1;
1919
}
2020

2121
do {
2222
echo 1;
23-
} while (!true);
23+
} while (! true);

tests/fixed/null_coalesce_operator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
$fooBar = isset($foo, $bar) ? 'foo' : 'bar';
1818

19-
$baz = !isset($foo) ? 'foo' : 'baz';
19+
$baz = ! isset($foo) ? 'foo' : 'baz';

tests/fixed/useless-semicolon.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
declare(strict_types=1);
44

5-
while (!true) {
5+
while (! true) {
66
echo 1;
77
}
88

99
do {
1010
echo 1;
11-
} while (!false);
11+
} while (! false);
1212

1313
for (;;) {
1414
echo 'To infity and beyond';

tests/input/EarlyReturn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function bar(): bool
1818
public function foo(): ?string
1919
{
2020
foreach ($itens as $item) {
21-
if (!($item->isItem())) {
21+
if (! ($item->isItem())) {
2222
return 'There is an item that is not an item';
2323
} else {
2424
continue;

tests/input/UselessConditions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function necessaryIfConditionWithMethodCall(): bool
126126

127127
public function nullShouldNotBeTreatedAsFalse(): ?bool
128128
{
129-
if (!$this->isAdmin) {
129+
if (! $this->isAdmin) {
130130
return null;
131131
}
132132

tests/input/example-class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function isBaz(): bool
7070
*/
7171
public function mangleBar(int $length) : void
7272
{
73-
if (!$this->baz) {
73+
if (! $this->baz) {
7474
throw new \InvalidArgumentException();
7575
}
7676

tests/input/null_coalesce_operator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
$fooBar = isset($foo, $bar) ? 'foo' : 'bar';
1818

19-
$baz = !isset($foo) ? 'foo' : 'baz';
19+
$baz = ! isset($foo) ? 'foo' : 'baz';

tests/input/useless-semicolon.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
declare(strict_types=1);
44

5-
while (!true) {
5+
while (! true) {
66
echo 1;
77
};
88

99
do {
1010
echo 1;
11-
} while (!false);
11+
} while (! false);
1212

1313
for (;;) {
1414
echo 'To infity and beyond';

tests/php-compatibility.patch

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ index eee1c6f..742226e 100644
1717
'array_key_exists' => true,
1818
'array_slice' => true,
1919
diff --git a/tests/expected_report.txt b/tests/expected_report.txt
20-
index 1ecfaaa..30d43c6 100644
20+
index 1ecfaaa..06d22b0 100644
2121
--- a/tests/expected_report.txt
2222
+++ b/tests/expected_report.txt
2323
@@ -6,45 +6,46 @@ FILE ERRORS WARNINGS
@@ -49,7 +49,8 @@ index 1ecfaaa..30d43c6 100644
4949
+tests/input/NamingCamelCase.php 8 0
5050
tests/input/negation-operator.php 2 0
5151
tests/input/new_with_parentheses.php 18 0
52-
tests/input/not_spacing.php 6 0
52+
-tests/input/not_spacing.php 6 0
53+
+tests/input/not_spacing.php 8 0
5354
tests/input/null_coalesce_operator.php 3 0
5455
-tests/input/optimized-functions.php 1 0
5556
-tests/input/return_type_on_closures.php 29 0
@@ -77,15 +78,15 @@ index 1ecfaaa..30d43c6 100644
7778
+tests/input/UselessConditions.php 23 0
7879
----------------------------------------------------------------------
7980
-A TOTAL OF 388 ERRORS AND 2 WARNINGS WERE FOUND IN 38 FILES
80-
+A TOTAL OF 364 ERRORS AND 2 WARNINGS WERE FOUND IN 39 FILES
81+
+A TOTAL OF 366 ERRORS AND 2 WARNINGS WERE FOUND IN 39 FILES
8182
----------------------------------------------------------------------
8283
-PHPCBF CAN FIX 331 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
83-
+PHPCBF CAN FIX 307 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
84+
+PHPCBF CAN FIX 309 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
8485
----------------------------------------------------------------------
8586

8687

8788
diff --git a/tests/fixed/example-class.php b/tests/fixed/example-class.php
88-
index 9df3d20..108bb03 100644
89+
index 0f98ce6..050d89c 100644
8990
--- a/tests/fixed/example-class.php
9091
+++ b/tests/fixed/example-class.php
9192
@@ -18,14 +18,12 @@ class Example implements \IteratorAggregate

0 commit comments

Comments
 (0)