Skip to content

Commit

Permalink
Use is_string() rather than !== null for extra clarity, succinctl…
Browse files Browse the repository at this point in the history
…y providing extra information.

Good suggestion.  I agree.  It's `null|string` (nothing else), so much clearer to test for the non-null type.

Co-authored-by: Oliver Klee <github@oliverklee.de>
  • Loading branch information
JakeQZ and oliverklee committed Sep 11, 2023
1 parent ab06897 commit a6f2c89
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions psalm.baseline.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.11.0@c9b192ab8400fdaf04b2b13d110575adc879aa90">
<file src="src/CssInliner.php">
<PossiblyNullOperand>
<code><![CDATA[$styleNode->nodeValue]]></code>
</PossiblyNullOperand>
</file>
<file src="tests/Support/Constraint/CssConstraint.php">
<DirectConstructorCall>
<code>parent::__construct()</code>
Expand Down
2 changes: 1 addition & 1 deletion src/CssInliner.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ private function getCssFromAllStyleNodes(): string

$css = '';
foreach ($styleNodes as $styleNode) {
if ($styleNode->nodeValue !== null) {
if (\is_string($styleNode->nodeValue)) {
$css .= "\n\n" . $styleNode->nodeValue;
}
$parentNode = $styleNode->parentNode;
Expand Down

0 comments on commit a6f2c89

Please sign in to comment.