Skip to content

Commit 7f80a2c

Browse files
authored
[TASK] Make Boolean tests explicit (#1332)
1 parent d0b3e9c commit 7f80a2c

File tree

3 files changed

+2
-14
lines changed

3 files changed

+2
-14
lines changed

config/phpstan-baseline.neon

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: '#^Only booleans are allowed in an if condition, string given\.$#'
5-
identifier: if.condNotBoolean
6-
count: 1
7-
path: ../src/CSSList/AtRuleBlockList.php
8-
93
-
104
message: '#^Call to function is_string\(\) with Sabberworm\\CSS\\Parsing\\ParserState will always evaluate to false\.$#'
115
identifier: function.impossibleType
@@ -48,12 +42,6 @@ parameters:
4842
count: 1
4943
path: ../src/Parsing/ParserState.php
5044

51-
-
52-
message: '#^Only booleans are allowed in an if condition, Sabberworm\\CSS\\Value\\RuleValueList\|string\|null given\.$#'
53-
identifier: if.condNotBoolean
54-
count: 1
55-
path: ../src/Rule/Rule.php
56-
5745
-
5846
message: '#^Parameters should have "string" types as the only types passed to this method$#'
5947
identifier: typePerfect.narrowPublicClassMethodParamType

src/CSSList/AtRuleBlockList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function render(OutputFormat $outputFormat): string
5555
$result = $formatter->comments($this);
5656
$result .= $outputFormat->getContentBeforeAtRuleBlock();
5757
$arguments = $this->arguments;
58-
if ($arguments) {
58+
if ($arguments !== '') {
5959
$arguments = ' ' . $arguments;
6060
}
6161
$result .= "@{$this->type}$arguments{$formatter->spaceBeforeOpeningBrace()}{";

src/Rule/Rule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function addValue($value, string $type = ' '): void
158158
if (!($this->value instanceof RuleValueList) || $this->value->getListSeparator() !== $type) {
159159
$currentValue = $this->value;
160160
$this->value = new RuleValueList($type, $this->getLineNumber());
161-
if ($currentValue) {
161+
if ($currentValue !== null && $currentValue !== '') {
162162
$this->value->addListComponent($currentValue);
163163
}
164164
}

0 commit comments

Comments
 (0)