diff --git a/composer-dependency-analyser.php b/composer-dependency-analyser.php index ced674a..625aeda 100644 --- a/composer-dependency-analyser.php +++ b/composer-dependency-analyser.php @@ -4,15 +4,6 @@ use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType; return (new Configuration()) - ->ignoreErrorsOnPackage('doctrine/dbal', [ErrorType::SHADOW_DEPENDENCY]) - ->ignoreErrorsOnPackage('symfony/config', [ErrorType::SHADOW_DEPENDENCY]) - ->ignoreErrorsOnPackage('symfony/dependency-injection', [ErrorType::SHADOW_DEPENDENCY]) - ->ignoreErrorsOnPackage('symfony/event-dispatcher-contracts', [ErrorType::SHADOW_DEPENDENCY]) - ->ignoreErrorsOnPackage('symfony/http-kernel', [ErrorType::SHADOW_DEPENDENCY]) - ->ignoreErrorsOnPackage('symfony/routing', [ErrorType::SHADOW_DEPENDENCY]) - ->ignoreErrorsOnPackage('symfony/security-core', [ErrorType::SHADOW_DEPENDENCY]) - ->ignoreErrorsOnPackage('symfony/service-contracts', [ErrorType::SHADOW_DEPENDENCY]) - // Optional integrations ->ignoreErrorsOnPackage('contao/calendar-bundle', [ErrorType::DEV_DEPENDENCY_IN_PROD]) ->ignoreErrorsOnPackage('contao/faq-bundle', [ErrorType::DEV_DEPENDENCY_IN_PROD]) diff --git a/composer.json b/composer.json index f3a6dd3..4428234 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,15 @@ "php": "^7.4 || ^8.0", "contao/core-bundle": "^4.13.25 || ^5.0", "league/uri": "^6.0 || ^7.0", - "league/uri-components": "^2.0 || ^7.0" + "league/uri-components": "^2.0 || ^7.0", + "doctrine/dbal": "^3.3", + "symfony/config": "^5.0 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.0 || ^6.0 || ^7.0", + "symfony/event-dispatcher-contracts": "^2.0 || ^3.0", + "symfony/http-kernel": "^5.0 || ^6.0 || ^7.0", + "symfony/routing": "^5.0 || ^6.0 || ^7.0", + "symfony/security-core": "^5.0 || ^6.0 || ^7.0", + "symfony/service-contracts": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "terminal42/contao-build-tools": "dev-main", diff --git a/src/Event/ChangelanguageNavigationEvent.php b/src/Event/ChangelanguageNavigationEvent.php index 4db6537..f91d1c9 100644 --- a/src/Event/ChangelanguageNavigationEvent.php +++ b/src/Event/ChangelanguageNavigationEvent.php @@ -24,20 +24,16 @@ public function __construct(NavigationItem $navigationItem, UrlParameterBag $url /** * Gets the navigation item for this event. - * - * @return NavigationItem */ - public function getNavigationItem() + public function getNavigationItem(): NavigationItem { return $this->navigationItem; } /** * Gets the UrlParameterBag for this navigation item. - * - * @return UrlParameterBag */ - public function getUrlParameterBag() + public function getUrlParameterBag(): UrlParameterBag { return $this->urlParameterBag; } diff --git a/src/EventListener/BackendView/ArticleViewListener.php b/src/EventListener/BackendView/ArticleViewListener.php index ec78dcc..98d4917 100644 --- a/src/EventListener/BackendView/ArticleViewListener.php +++ b/src/EventListener/BackendView/ArticleViewListener.php @@ -80,7 +80,7 @@ protected function getAvailableLanguages(PageModel $page): array $articles = array_values(array_filter( $articles, - fn (ArticleModel $article) => $article->inColumn === $this->currentArticle->inColumn, + fn (ArticleModel $article): bool => $article->inColumn === $this->currentArticle->inColumn, )); if (1 === \count($articles)) { diff --git a/src/EventListener/BackendView/ParentChildViewListener.php b/src/EventListener/BackendView/ParentChildViewListener.php index d56ff46..386575f 100644 --- a/src/EventListener/BackendView/ParentChildViewListener.php +++ b/src/EventListener/BackendView/ParentChildViewListener.php @@ -21,7 +21,7 @@ class ParentChildViewListener extends AbstractViewListener */ private $current = false; - protected function isSupported() + protected function isSupported(): bool { return $this->getTable() === Input::get('table') && ( ('news' === Input::get('do') && InstalledVersions::isInstalled('contao/news-bundle')) @@ -104,12 +104,8 @@ protected function doSwitchView($id): void /** * Finds related item for a given page. - * - * @param int $id - * - * @return Model|null */ - private function findRelatedForPageAndId(PageModel $page, $id) + private function findRelatedForPageAndId(PageModel $page, int $id): ?Model { /** @var Model $class */ $class = $this->getModelClass(); diff --git a/src/EventListener/DataContainer/ParentTableListener.php b/src/EventListener/DataContainer/ParentTableListener.php index 27d50e1..69ffb7b 100644 --- a/src/EventListener/DataContainer/ParentTableListener.php +++ b/src/EventListener/DataContainer/ParentTableListener.php @@ -29,7 +29,7 @@ public function register(): void 'label' => &$GLOBALS['TL_LANG'][$this->table]['master'], 'exclude' => true, 'inputType' => 'select', - 'options_callback' => fn (DataContainer $dc) => $this->onMasterOptions($dc), + 'options_callback' => fn (DataContainer $dc): array => $this->onMasterOptions($dc), 'eval' => [ 'includeBlankOption' => true, 'blankOptionLabel' => &$GLOBALS['TL_LANG'][$this->table]['isMaster'], diff --git a/src/EventListener/Navigation/ArticleNavigationListener.php b/src/EventListener/Navigation/ArticleNavigationListener.php index aac1a58..bb4895e 100644 --- a/src/EventListener/Navigation/ArticleNavigationListener.php +++ b/src/EventListener/Navigation/ArticleNavigationListener.php @@ -57,7 +57,7 @@ public function __invoke(ChangelanguageNavigationEvent $event): void $targetArticle = $this->findTargetArticle( $currentArticle, - $targetRoot->id, + (int) $targetRoot->id, $objPage->rootId === $masterRoot->id, null !== $masterRoot && $targetRoot->id === $masterRoot->id, ); @@ -71,12 +71,8 @@ public function __invoke(ChangelanguageNavigationEvent $event): void /** * Find target article for a root page and current article. - * - * @param int $targetRootId - * @param bool $currentIsFallback - * @param bool $targetIsFallback */ - private function findTargetArticle(ArticleModel $currentArticle, $targetRootId, $currentIsFallback, $targetIsFallback): ?ArticleModel + private function findTargetArticle(ArticleModel $currentArticle, int $targetRootId, bool $currentIsFallback, bool $targetIsFallback): ?ArticleModel { // If the target root is fallback, the article ID will match our current "languageMain" if ($targetIsFallback) { diff --git a/src/FrontendModule/ChangeLanguageModule.php b/src/FrontendModule/ChangeLanguageModule.php index 6237cfd..2dc5803 100755 --- a/src/FrontendModule/ChangeLanguageModule.php +++ b/src/FrontendModule/ChangeLanguageModule.php @@ -4,7 +4,6 @@ namespace Terminal42\ChangeLanguage\FrontendModule; -use Contao\ArrayUtil; use Contao\BackendTemplate; use Contao\FrontendTemplate; use Contao\Input; @@ -212,7 +211,7 @@ protected function createUrlParameterBag(array $queryParameters = []): UrlParame array_unshift($fragments, 'auto_item'); } - for ($i=0, $c=\count($fragments); $i<$c; $i+=2) { + for ($i = 0, $c = \count($fragments); $i < $c; $i += 2) { $attributes[$fragments[$i]] = $fragments[$i + 1]; } } diff --git a/src/Helper/LanguageText.php b/src/Helper/LanguageText.php index ce9985f..bd28c2e 100644 --- a/src/Helper/LanguageText.php +++ b/src/Helper/LanguageText.php @@ -79,7 +79,7 @@ public function orderNavigationItems(array &$items): void usort( $items, - static function (NavigationItem $a, NavigationItem $b) use ($languages) { + static function (NavigationItem $a, NavigationItem $b) use ($languages): int { $key1 = array_search(strtolower($a->getLocaleId()), $languages, true); $key2 = array_search(strtolower($b->getLocaleId()), $languages, true); diff --git a/src/PageFinder.php b/src/PageFinder.php index 84e6515..e53863a 100644 --- a/src/PageFinder.php +++ b/src/PageFinder.php @@ -125,7 +125,7 @@ public function findAssociatedForPage(PageModel $page, bool $skipCurrent = false return array_filter( $this->findPages($columns, $values), - static function (PageModel $page) use ($rootPages) { + static function (PageModel $page) use ($rootPages): bool { $page->loadDetails(); return \array_key_exists($page->rootId, $rootPages);