diff --git a/src/EventListener/BackendView/ArticleViewListener.php b/src/EventListener/BackendView/ArticleViewListener.php index 8853346..23b8f1f 100644 --- a/src/EventListener/BackendView/ArticleViewListener.php +++ b/src/EventListener/BackendView/ArticleViewListener.php @@ -26,7 +26,8 @@ class ArticleViewListener extends AbstractViewListener protected function isSupported() { return 'article' === (string) Input::get('do') - && (('edit' === Input::get('act') && empty(Input::get('table'))) + && ( + ('edit' === Input::get('act') && empty(Input::get('table'))) || ($this->getTable() === Input::get('table')) ); } @@ -83,9 +84,12 @@ protected function getAvailableLanguages(PageModel $page) } } - $articles = array_values(array_filter($articles, function (ArticleModel $article) { - return $article->inColumn === $this->currentArticle->inColumn; - })); + $articles = array_values(array_filter( + $articles, + function (ArticleModel $article) { + return $article->inColumn === $this->currentArticle->inColumn; + } + )); if (1 === \count($articles)) { $options[$articles[0]->id] = $this->getLanguageLabel($model->language); diff --git a/src/EventListener/DataContainer/ArticleListener.php b/src/EventListener/DataContainer/ArticleListener.php index 6dd2cee..49cfc01 100644 --- a/src/EventListener/DataContainer/ArticleListener.php +++ b/src/EventListener/DataContainer/ArticleListener.php @@ -35,7 +35,7 @@ public function onLoad(DataContainer $dc): void } elseif ('edit' === $action) { $article = ArticleModel::findByPk($dc->id); - if ($article !== null) { + if (null !== $article) { $page = PageModel::findByPk($article->pid); if (null !== $page && null !== (new PageFinder())->findAssociatedInMaster($page)) { diff --git a/src/EventListener/DataContainer/MissingLanguageIconListener.php b/src/EventListener/DataContainer/MissingLanguageIconListener.php index 0e2cd2e..8d36dff 100644 --- a/src/EventListener/DataContainer/MissingLanguageIconListener.php +++ b/src/EventListener/DataContainer/MissingLanguageIconListener.php @@ -84,7 +84,7 @@ public function onPageLabel(array $args, $previousResult = null) return sprintf( '%s (%s)', $label, - Backend::addToUrl('pn=' . $mainPage->id), + Backend::addToUrl('pn='.$mainPage->id), StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['selectNode']), $mainPage->title ); @@ -135,13 +135,13 @@ public function onNewsChildRecords(array $args, $previousResult = null) $label = (string) $previousResult; if (empty($label)) { - $label = '
' . $row['headline'] . ' [' . Date::parse(Config::get('datimFormat'), $row['date']) . ']
'; + $label = '
'.$row['headline'].' ['.Date::parse(Config::get('datimFormat'), $row['date']).']
'; } $archive = NewsArchiveModel::findByPk($row['pid']); if ( - $archive !== null + null !== $archive && $archive->master && (!$row['languageMain'] || null === NewsModel::findByPk($row['languageMain'])) ) { @@ -166,7 +166,7 @@ public function onCalendarEventChildRecords(array $args, $previousResult = null) $calendar = CalendarModel::findByPk($row['pid']); if ( - $calendar !== null + null !== $calendar && $calendar->master && (!$row['languageMain'] || null === CalendarEventsModel::findByPk($row['languageMain'])) ) { @@ -191,7 +191,7 @@ public function onFaqChildRecords(array $args, $previousResult = null) $category = FaqCategoryModel::findByPk($row['pid']); if ( - $category !== null + null !== $category && $category->master && (!$row['languageMain'] || null === FaqModel::findByPk($row['languageMain'])) ) { diff --git a/src/EventListener/Navigation/AbstractNavigationListener.php b/src/EventListener/Navigation/AbstractNavigationListener.php index 87acb60..b630e8f 100644 --- a/src/EventListener/Navigation/AbstractNavigationListener.php +++ b/src/EventListener/Navigation/AbstractNavigationListener.php @@ -102,7 +102,7 @@ protected function getAutoItem(): string || ( $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($GLOBALS['TL_AUTO_ITEM']) - && in_array($strKey, $GLOBALS['TL_AUTO_ITEM'], true) + && \in_array($strKey, $GLOBALS['TL_AUTO_ITEM'], true) ) ) { $strKey = 'auto_item'; diff --git a/src/FrontendModule/ChangeLanguageModule.php b/src/FrontendModule/ChangeLanguageModule.php index 303b9b8..41004b1 100755 --- a/src/FrontendModule/ChangeLanguageModule.php +++ b/src/FrontendModule/ChangeLanguageModule.php @@ -58,10 +58,10 @@ public function generate() $request = System::getContainer()->get('request_stack')->getCurrentRequest(); $scopeMatcher = System::getContainer()->get('contao.routing.scope_matcher'); - if ($request !== null && $scopeMatcher->isBackendRequest($request)) { + if (null !== $request && $scopeMatcher->isBackendRequest($request)) { $template = new BackendTemplate('be_wildcard'); - $template->wildcard = '### ' . strtoupper($GLOBALS['TL_LANG']['FMD'][$this->type][0]) . ' ###'; + $template->wildcard = '### '.strtoupper($GLOBALS['TL_LANG']['FMD'][$this->type][0]).' ###'; $template->title = $this->headline; $template->id = $this->id; $template->link = $this->name; @@ -203,6 +203,7 @@ protected function createUrlParameterBag(array $queryParameters = []) unset($input['language'], $input['auto_item']); $currentQuery = []; + if (!empty($_SERVER['QUERY_STRING'])) { parse_str($_SERVER['QUERY_STRING'], $currentQuery); } diff --git a/src/Helper/LabelCallback.php b/src/Helper/LabelCallback.php index 6d54aae..8bf9507 100644 --- a/src/Helper/LabelCallback.php +++ b/src/Helper/LabelCallback.php @@ -73,6 +73,6 @@ private function executeCallback($callback, array $args) ); } - return \call_user_func_array($callback, $args); + return $callback(...$args); } } diff --git a/src/Helper/LanguageText.php b/src/Helper/LanguageText.php index e300d46..b429eac 100644 --- a/src/Helper/LanguageText.php +++ b/src/Helper/LanguageText.php @@ -4,7 +4,6 @@ namespace Terminal42\ChangeLanguage\Helper; -use Contao\Controller; use Contao\StringUtil; use Contao\System; use Terminal42\ChangeLanguage\Navigation\NavigationItem; diff --git a/src/Migration/CustomLanguageTextMigration.php b/src/Migration/CustomLanguageTextMigration.php index f4fdb80..11e7e79 100644 --- a/src/Migration/CustomLanguageTextMigration.php +++ b/src/Migration/CustomLanguageTextMigration.php @@ -1,5 +1,7 @@ =1.11.0 <1.14.0", + "squizlabs/php_codesniffer": "^3.7.1" }, "require-dev": { - "phing/phing": "2.17.3", + "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.4.10|1.7.1", + "phpstan/phpstan": "1.4.10|1.9.2", "phpstan/phpstan-deprecation-rules": "1.0.0", - "phpstan/phpstan-phpunit": "1.0.0|1.1.1", - "phpstan/phpstan-strict-rules": "1.2.3", - "phpunit/phpunit": "7.5.20|8.5.21|9.5.20" + "phpstan/phpstan-phpunit": "1.0.0|1.2.2", + "phpstan/phpstan-strict-rules": "1.4.4", + "phpunit/phpunit": "7.5.20|8.5.21|9.5.26" }, "type": "phpcodesniffer-standard", "extra": { "branch-alias": { - "dev-master": "7.x-dev" + "dev-master": "8.x-dev" } }, "autoload": { @@ -216,9 +222,13 @@ "MIT" ], "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "keywords": [ + "dev", + "phpcs" + ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/7.2.1" + "source": "https://github.com/slevomat/coding-standard/tree/8.6.4" }, "funding": [ { @@ -230,7 +240,7 @@ "type": "tidelift" } ], - "time": "2022-05-25T10:58:12+00:00" + "time": "2022-11-14T09:26:24+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -290,20 +300,20 @@ }, { "name": "symplify/easy-coding-standard", - "version": "9.4.70", + "version": "10.3.3", "source": { "type": "git", "url": "https://github.com/symplify/easy-coding-standard.git", - "reference": "9276b0c7a1a5671fc4a067656ab40d0aea42aaca" + "reference": "c93878b3c052321231519b6540e227380f90be17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symplify/easy-coding-standard/zipball/9276b0c7a1a5671fc4a067656ab40d0aea42aaca", - "reference": "9276b0c7a1a5671fc4a067656ab40d0aea42aaca", + "url": "https://api.github.com/repos/symplify/easy-coding-standard/zipball/c93878b3c052321231519b6540e227380f90be17", + "reference": "c93878b3c052321231519b6540e227380f90be17", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "conflict": { "friendsofphp/php-cs-fixer": "<3.0", @@ -315,7 +325,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "9.5-dev" + "dev-main": "10.3-dev" } }, "autoload": { @@ -329,7 +339,7 @@ ], "description": "Prefixed scoped version of ECS package", "support": { - "source": "https://github.com/symplify/easy-coding-standard/tree/9.4.70" + "source": "https://github.com/symplify/easy-coding-standard/tree/10.3.3" }, "funding": [ { @@ -341,7 +351,7 @@ "type": "github" } ], - "time": "2021-10-02T16:09:04+00:00" + "time": "2022-06-13T14:03:37+00:00" } ], "packages-dev": [],