Skip to content

Commit 55b1ddb

Browse files
authored
[CLEANUP] rector: Changes unneeded null check to ?? operator (#552)
This applies the rule TernaryToNullCoalescingRector. For details see: https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#ternarytonullcoalescingrector Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
1 parent 2b5d935 commit 55b1ddb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/RuleSet/DeclarationBlock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ public function createFontShorthand()
735735
if (!isset($aRules['font-size']) || !isset($aRules['font-family'])) {
736736
return;
737737
}
738-
$oOldRule = isset($aRules['font-size']) ? $aRules['font-size'] : $aRules['font-family'];
738+
$oOldRule = $aRules['font-size'] ?? $aRules['font-family'];
739739
$oNewRule = new Rule('font', $oOldRule->getLineNo(), $oOldRule->getColNo());
740740
unset($oOldRule);
741741
foreach (['font-style', 'font-variant', 'font-weight'] as $sProperty) {

src/Value/Size.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,6 @@ public function render(OutputFormat $oOutputFormat)
219219
$sSize = preg_match("/[\d\.]+e[+-]?\d+/i", (string) $this->fSize)
220220
? preg_replace("/$sPoint?0+$/", "", sprintf("%f", $this->fSize)) : $this->fSize;
221221
return preg_replace(["/$sPoint/", "/^(-?)0\./"], ['.', '$1.'], $sSize)
222-
. ($this->sUnit === null ? '' : $this->sUnit);
222+
. ($this->sUnit ?? '');
223223
}
224224
}

0 commit comments

Comments
 (0)