From 7a3bce55d2bdf8f76dbffca50894e11700145f9b Mon Sep 17 00:00:00 2001 From: Johannes Wachter Date: Mon, 7 Aug 2023 21:26:46 +0200 Subject: [PATCH 1/4] fix article-bridge language-code --- Document/Structure/ArticleBridge.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Document/Structure/ArticleBridge.php b/Document/Structure/ArticleBridge.php index 3b5a10b2..f1243aad 100644 --- a/Document/Structure/ArticleBridge.php +++ b/Document/Structure/ArticleBridge.php @@ -107,4 +107,19 @@ public function setWebspaceKey($webspace) { $this->webspaceKey = $webspace; } + + + public function getLanguageCode() + { + if (!$this->document) { + return $this->locale; + } + + // return original locale for shadow or ghost pages + if ($this->getIsShadow() || ($this->getType() && 'ghost' === $this->getType()->getName())) { + return $this->inspector->getOriginalLocale($this->getDocument()); + } + + return parent::getLanguageCode(); + } } From 860dec2635f8e1f96a36c95b840cec250206475c Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Tue, 8 Aug 2023 11:50:55 +0200 Subject: [PATCH 2/4] Fix phpstan baseline --- phpstan-baseline.neon | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1c870335..b45e97af 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -385,6 +385,11 @@ parameters: count: 1 path: Controller/ArticleController.php + - + message: "#^Parameter \\#1 \\$type of method Symfony\\\\Component\\\\Form\\\\FormFactoryInterface\\:\\:create\\(\\) expects class\\-string\\\\>, string given\\.$#" + count: 1 + path: Controller/ArticleController.php + - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\|null given\\.$#" count: 1 @@ -455,6 +460,11 @@ parameters: count: 2 path: Controller/ArticlePageController.php + - + message: "#^Parameter \\#1 \\$type of method Symfony\\\\Component\\\\Form\\\\FormFactoryInterface\\:\\:create\\(\\) expects class\\-string\\\\>, string given\\.$#" + count: 1 + path: Controller/ArticlePageController.php + - message: "#^Call to an undefined method object\\:\\:getVersions\\(\\)\\.$#" count: 1 @@ -1455,6 +1465,11 @@ parameters: count: 1 path: Document/Structure/ArticleBridge.php + - + message: "#^Left side of && is always true\\.$#" + count: 1 + path: Document/Structure/ArticleBridge.php + - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Document\\\\Structure\\\\ArticleBridge\\:\\:getConcreteLanguages\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -1485,6 +1500,11 @@ parameters: count: 1 path: Document/Structure/ArticleBridge.php + - + message: "#^Negated boolean expression is always false\\.$#" + count: 1 + path: Document/Structure/ArticleBridge.php + - message: "#^Parameter \\#1 \\$document of method Sulu\\\\Bundle\\\\DocumentManagerBundle\\\\Bridge\\\\DocumentInspector\\:\\:getConcreteLocales\\(\\) expects Sulu\\\\Component\\\\Content\\\\Document\\\\Behavior\\\\ShadowLocaleBehavior, object given\\.$#" count: 1 From ec11302f3aa82fea4584f365ba9484fc7f517ac6 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Tue, 8 Aug 2023 11:52:27 +0200 Subject: [PATCH 3/4] Fix phpstan baseline SuluArticleBundle --- SuluArticleBundle.php | 2 +- phpstan-baseline.neon | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/SuluArticleBundle.php b/SuluArticleBundle.php index fbdb9987..ae87c224 100644 --- a/SuluArticleBundle.php +++ b/SuluArticleBundle.php @@ -23,7 +23,7 @@ */ class SuluArticleBundle extends Bundle { - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { $container->addCompilerPass(new ConverterCompilerPass()); $container->addCompilerPass(new StructureValidatorCompilerPass(), PassConfig::TYPE_AFTER_REMOVING); diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index b45e97af..98be553f 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -385,11 +385,6 @@ parameters: count: 1 path: Controller/ArticleController.php - - - message: "#^Parameter \\#1 \\$type of method Symfony\\\\Component\\\\Form\\\\FormFactoryInterface\\:\\:create\\(\\) expects class\\-string\\\\>, string given\\.$#" - count: 1 - path: Controller/ArticleController.php - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\|null given\\.$#" count: 1 @@ -460,11 +455,6 @@ parameters: count: 2 path: Controller/ArticlePageController.php - - - message: "#^Parameter \\#1 \\$type of method Symfony\\\\Component\\\\Form\\\\FormFactoryInterface\\:\\:create\\(\\) expects class\\-string\\\\>, string given\\.$#" - count: 1 - path: Controller/ArticlePageController.php - - message: "#^Call to an undefined method object\\:\\:getVersions\\(\\)\\.$#" count: 1 From 734c7d07533a8697e4efb1551047edea32ddc0d3 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Tue, 8 Aug 2023 11:54:33 +0200 Subject: [PATCH 4/4] Fix code style --- Document/Structure/ArticleBridge.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Document/Structure/ArticleBridge.php b/Document/Structure/ArticleBridge.php index f1243aad..0d3407f3 100644 --- a/Document/Structure/ArticleBridge.php +++ b/Document/Structure/ArticleBridge.php @@ -108,7 +108,6 @@ public function setWebspaceKey($webspace) $this->webspaceKey = $webspace; } - public function getLanguageCode() { if (!$this->document) {