Skip to content

Commit

Permalink
Prefer empty() instead of null coalescing operator
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Apr 3, 2024
1 parent 4b80725 commit e4ab25c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/helpers/SEOMateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

use Illuminate\Support\Collection;

use Symfony\Component\DomCrawler\Field\ChoiceFormField;
use vaersaagod\seomate\models\Settings;
use vaersaagod\seomate\SEOMate;

Expand Down Expand Up @@ -146,7 +147,7 @@ public static function getPropertyDataByScopeAndHandle(ElementInterface|array $s
}
}

if (\str_contains(trim($handle), '{')) {
if (str_contains(trim($handle), '{')) {
try {
return Craft::$app->getView()->renderObjectTemplate($handle, $scope);
} catch (\Throwable $throwable) {
Expand All @@ -155,7 +156,7 @@ public static function getPropertyDataByScopeAndHandle(ElementInterface|array $s
}
}

if ($scope[$handle] ?? null) {
if (!empty($scope[$handle])) {
if ($type === 'text') {
return static::getStringPropertyValue($scope[$handle]);
}
Expand Down

0 comments on commit e4ab25c

Please sign in to comment.