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

0 commit comments

Comments
 (0)