From 41b8c02c688636325473b8b0af19bc8eae07cbb4 Mon Sep 17 00:00:00 2001 From: Martin Lagler Date: Mon, 18 Mar 2024 13:18:17 +0100 Subject: [PATCH] Fix changed date for sitemape --- Content/ArticleDataProvider.php | 2 ++ Content/PageTreeArticleDataProvider.php | 4 ++- Sitemap/ArticleSitemapProvider.php | 1 + phpstan-baseline.neon | 47 ++++++------------------- 4 files changed, 17 insertions(+), 37 deletions(-) diff --git a/Content/ArticleDataProvider.php b/Content/ArticleDataProvider.php index eb1ed07d..75b2bda5 100644 --- a/Content/ArticleDataProvider.php +++ b/Content/ArticleDataProvider.php @@ -176,6 +176,7 @@ public function resolveDataItems( $filters['types'] = $this->getTypesProperty($propertyParameter); $filters['excluded'] = $this->getExcludedFilter($filters, $propertyParameter); + /** @var string|null $locale */ $locale = $options['locale']; $webspaceKey = $this->getWebspaceKey($propertyParameter, $options); $queryResult = $this->getSearchResult($filters, $limit, $page, $pageSize, $locale, $webspaceKey); @@ -206,6 +207,7 @@ public function resolveResourceItems( $filters['types'] = $this->getTypesProperty($propertyParameter); $filters['excluded'] = $this->getExcludedFilter($filters, $propertyParameter); + /** @var string|null $locale */ $locale = $options['locale']; $webspaceKey = $this->getWebspaceKey($propertyParameter, $options); $queryResult = $this->getSearchResult($filters, $limit, $page, $pageSize, $locale, $webspaceKey); diff --git a/Content/PageTreeArticleDataProvider.php b/Content/PageTreeArticleDataProvider.php index b1291576..b49660ef 100644 --- a/Content/PageTreeArticleDataProvider.php +++ b/Content/PageTreeArticleDataProvider.php @@ -35,7 +35,9 @@ public function resolveDatasource($datasource, array $propertyParameter, array $ return null; } - $document = $this->documentManager->find($datasource, $options['locale']); + /** @var string|null $locale */ + $locale = $options['locale']; + $document = $this->documentManager->find($datasource, $locale); if (!$document instanceof BasePageDocument) { return null; diff --git a/Sitemap/ArticleSitemapProvider.php b/Sitemap/ArticleSitemapProvider.php index 7990375e..2e5adc2e 100644 --- a/Sitemap/ArticleSitemapProvider.php +++ b/Sitemap/ArticleSitemapProvider.php @@ -109,6 +109,7 @@ protected function buildUrl( return new SitemapUrl( $this->findUrl($articleView, $scheme, $host, $webspaceKey), $articleView->getLocale(), + null, $articleView->getChanged() ); } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d064cd2b..36c27327 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -170,36 +170,11 @@ parameters: count: 1 path: Content/ArticleDataProvider.php - - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Content\\\\ArticleDataProvider\\:\\:resolveDataItems\\(\\) has parameter \\$filters with no value type specified in iterable type array\\.$#" - count: 1 - path: Content/ArticleDataProvider.php - - - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Content\\\\ArticleDataProvider\\:\\:resolveDataItems\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" - count: 1 - path: Content/ArticleDataProvider.php - - - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Content\\\\ArticleDataProvider\\:\\:resolveDatasource\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" - count: 1 - path: Content/ArticleDataProvider.php - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Content\\\\ArticleDataProvider\\:\\:resolveDatasource\\(\\) should return Sulu\\\\Component\\\\SmartContent\\\\DatasourceItemInterface but empty return statement found\\.$#" count: 1 path: Content/ArticleDataProvider.php - - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Content\\\\ArticleDataProvider\\:\\:resolveResourceItems\\(\\) has parameter \\$filters with no value type specified in iterable type array\\.$#" - count: 1 - path: Content/ArticleDataProvider.php - - - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Content\\\\ArticleDataProvider\\:\\:resolveResourceItems\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" - count: 1 - path: Content/ArticleDataProvider.php - - message: "#^Negated boolean expression is always false\\.$#" count: 1 @@ -280,18 +255,13 @@ parameters: count: 1 path: Content/PageTreeArticleDataProvider.php - - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Content\\\\PageTreeArticleDataProvider\\:\\:resolveDatasource\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" - count: 1 - path: Content/PageTreeArticleDataProvider.php - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Content\\\\PageTreeArticleDataProvider\\:\\:resolveDatasource\\(\\) should return Sulu\\\\Component\\\\SmartContent\\\\DatasourceItemInterface but returns null\\.$#" count: 2 path: Content/PageTreeArticleDataProvider.php - - message: "#^Parameter \\#1 \\$identifier of method Sulu\\\\Component\\\\DocumentManager\\\\DocumentManagerInterface\\:\\:find\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$identifier of method Sulu\\\\Component\\\\DocumentManager\\\\DocumentManagerInterface\\:\\:find\\(\\) expects string, int\\\\|int\\<1, max\\>\\|string given\\.$#" count: 1 path: Content/PageTreeArticleDataProvider.php @@ -2075,6 +2045,16 @@ parameters: count: 1 path: Import/ImportResult.php + - + message: "#^Parameter \\#1 \\$filters of method Sulu\\\\Component\\\\SmartContent\\\\DataProviderInterface\\:\\:resolveResourceItems\\(\\) expects array\\{dataSource\\?\\: int\\|string\\|null, sortMethod\\?\\: 'asc'\\|'desc', sortBy\\?\\: string, tags\\?\\: array\\, tagOperator\\?\\: 'and'\\|'or', types\\?\\: array\\, categories\\?\\: array\\, categoryOperator\\?\\: 'and'\\|'or', \\.\\.\\.\\}, array given\\.$#" + count: 1 + path: Infrastructure/Sulu/Headless/DataProviderResolver/AbstractArticleDataProviderResolver.php + + - + message: "#^Parameter \\#1 \\$filters of method Sulu\\\\Component\\\\SmartContent\\\\DataProviderInterface\\:\\:resolveResourceItems\\(\\) expects array\\{dataSource\\?\\: int\\|string\\|null, sortMethod\\?\\: 'asc'\\|'desc', sortBy\\?\\: string, tags\\?\\: array\\, tagOperator\\?\\: 'and'\\|'or', types\\?\\: array\\, categories\\?\\: array\\, categoryOperator\\?\\: 'and'\\|'or', \\.\\.\\.\\}, array given\\.$#" + count: 1 + path: Infrastructure/SuluHeadlessBundle/DataProviderResolver/AbstractArticleDataProviderResolver.php + - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\ListBuilder\\\\ElasticSearchFieldDescriptorBuilder\\:\\:setSearchability\\(\\) has no return type specified\\.$#" count: 1 @@ -2385,11 +2365,6 @@ parameters: count: 1 path: Sitemap/ArticleSitemapProvider.php - - - message: "#^Parameter \\#3 \\$defaultLocale of class Sulu\\\\Bundle\\\\WebsiteBundle\\\\Sitemap\\\\SitemapUrl constructor expects string\\|null, DateTime given\\.$#" - count: 1 - path: Sitemap/ArticleSitemapProvider.php - - message: "#^Cannot call method getExcerpt\\(\\) on mixed\\.$#" count: 1