diff --git a/Document/Structure/ContentProxyFactory.php b/Document/Structure/ContentProxyFactory.php index 1fe27b1c..599e84c9 100644 --- a/Document/Structure/ContentProxyFactory.php +++ b/Document/Structure/ContentProxyFactory.php @@ -150,17 +150,16 @@ private function getWebspaceKey(): ?string return null; } - if ($attributes->hasAttribute('webspaceKey')) { - return $attributes->getAttribute('webspaceKey'); + $webspaceKey = $attributes->getAttribute('webspaceKey'); + if (\is_string($webspaceKey) && '' !== $webspaceKey) { + return $webspaceKey; } - if ($attributes->hasAttribute('webspace')) { - $webspace = $attributes->getAttribute('webspace'); - if ($webspace instanceof Webspace) { - return $webspace->getKey(); - } elseif (\is_string($webspace) && '' !== $webspace) { - return $webspace; - } + $webspace = $attributes->getAttribute('webspace'); + if ($webspace instanceof Webspace) { + return $webspace->getKey(); + } elseif (\is_string($webspace) && '' !== $webspace) { + return $webspace; } return null; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 3faf98b4..6a939762 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1460,11 +1460,6 @@ parameters: count: 1 path: Document/Structure/ContentProxyFactory.php - - - message: "#^Negated boolean expression is always false\\.$#" - count: 1 - path: Document/Structure/ContentProxyFactory.php - - message: "#^Parameter \\#1 \\$webspace of method Sulu\\\\Component\\\\Content\\\\Compat\\\\StructureInterface\\:\\:setWebspaceKey\\(\\) expects string, string\\|null given\\.$#" count: 2