Skip to content

Commit

Permalink
Fix issue with none existing webspace in requestAnalyzer in asnyc pro…
Browse files Browse the repository at this point in the history
…cesses
  • Loading branch information
alexander-schranz committed Nov 26, 2024
1 parent ef1f0dc commit 21c03cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
19 changes: 9 additions & 10 deletions Document/Structure/ContentProxyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ContentProxyFactory
public function __construct(
ContentTypeManagerInterface $contentTypeManager,
LazyLoadingValueHolderFactory $proxyFactory,
RequestStack $requestStack,
RequestStack $requestStack
) {
$this->contentTypeManager = $contentTypeManager;
$this->proxyFactory = $proxyFactory;
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 21c03cc

Please sign in to comment.