From e7a8b2b9aa0f24ef47812e018fd27fa754fb6bf9 Mon Sep 17 00:00:00 2001 From: Daniel Ziegenberg Date: Mon, 17 Jun 2024 15:34:38 +0200 Subject: [PATCH] [CLEANUP] rector: Changes unneeded null check to ?? operator 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 --- src/RuleSet/DeclarationBlock.php | 2 +- src/Value/Size.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RuleSet/DeclarationBlock.php b/src/RuleSet/DeclarationBlock.php index 91f5ecef..e51e782f 100644 --- a/src/RuleSet/DeclarationBlock.php +++ b/src/RuleSet/DeclarationBlock.php @@ -735,7 +735,7 @@ public function createFontShorthand() if (!isset($aRules['font-size']) || !isset($aRules['font-family'])) { return; } - $oOldRule = isset($aRules['font-size']) ? $aRules['font-size'] : $aRules['font-family']; + $oOldRule = $aRules['font-size'] ?? $aRules['font-family']; $oNewRule = new Rule('font', $oOldRule->getLineNo(), $oOldRule->getColNo()); unset($oOldRule); foreach (['font-style', 'font-variant', 'font-weight'] as $sProperty) { diff --git a/src/Value/Size.php b/src/Value/Size.php index f8336b1f..0ef3e6ac 100644 --- a/src/Value/Size.php +++ b/src/Value/Size.php @@ -219,6 +219,6 @@ public function render(OutputFormat $oOutputFormat) $sSize = preg_match("/[\d\.]+e[+-]?\d+/i", (string) $this->fSize) ? preg_replace("/$sPoint?0+$/", "", sprintf("%f", $this->fSize)) : $this->fSize; return preg_replace(["/$sPoint/", "/^(-?)0\./"], ['.', '$1.'], $sSize) - . ($this->sUnit === null ? '' : $this->sUnit); + . ($this->sUnit ?? ''); } }