Skip to content

Commit

Permalink
Run the CS fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Nov 29, 2022
1 parent f057dba commit 63ecac4
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 59 deletions.
12 changes: 8 additions & 4 deletions src/EventListener/BackendView/ArticleViewListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
);
}
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/DataContainer/ArticleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
10 changes: 5 additions & 5 deletions src/EventListener/DataContainer/MissingLanguageIconListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function onPageLabel(array $args, $previousResult = null)
return sprintf(
'%s <span style="color:#999;padding-left:3px">(<a href="%s" title="%s" style="color:#999">%s</a>)</span>',
$label,
Backend::addToUrl('pn=' . $mainPage->id),
Backend::addToUrl('pn='.$mainPage->id),
StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['selectNode']),
$mainPage->title
);
Expand Down Expand Up @@ -135,13 +135,13 @@ public function onNewsChildRecords(array $args, $previousResult = null)
$label = (string) $previousResult;

if (empty($label)) {
$label = '<div class="tl_content_left">' . $row['headline'] . ' <span style="color:#999;padding-left:3px">[' . Date::parse(Config::get('datimFormat'), $row['date']) . ']</span></div>';
$label = '<div class="tl_content_left">'.$row['headline'].' <span style="color:#999;padding-left:3px">['.Date::parse(Config::get('datimFormat'), $row['date']).']</span></div>';
}

$archive = NewsArchiveModel::findByPk($row['pid']);

if (
$archive !== null
null !== $archive
&& $archive->master
&& (!$row['languageMain'] || null === NewsModel::findByPk($row['languageMain']))
) {
Expand All @@ -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']))
) {
Expand All @@ -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']))
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
5 changes: 3 additions & 2 deletions src/FrontendModule/ChangeLanguageModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/LabelCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ private function executeCallback($callback, array $args)
);
}

return \call_user_func_array($callback, $args);
return $callback(...$args);
}
}
1 change: 0 additions & 1 deletion src/Helper/LanguageText.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Terminal42\ChangeLanguage\Helper;

use Contao\Controller;
use Contao\StringUtil;
use Contao\System;
use Terminal42\ChangeLanguage\Navigation\NavigationItem;
Expand Down
6 changes: 4 additions & 2 deletions src/Migration/CustomLanguageTextMigration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Terminal42\ChangeLanguage\Migration;

use Contao\CoreBundle\Framework\ContaoFramework;
Expand Down Expand Up @@ -38,7 +40,7 @@ public function shouldRun(): bool
foreach ($texts as $text) {
$text = StringUtil::deserialize($text);

if (is_array($text) && isset($text[0]['label'])) {
if (\is_array($text) && isset($text[0]['label'])) {
return true;
}
}
Expand All @@ -55,7 +57,7 @@ public function run(): MigrationResult
foreach ($records as $record) {
$data = StringUtil::deserialize($record['customLanguageText']);

if (is_array($data) && isset($data[0]['label'])) {
if (\is_array($data) && isset($data[0]['label'])) {
$newData = [];

foreach ($data as $datum) {
Expand Down
4 changes: 2 additions & 2 deletions src/Navigation/NavigationItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ public function getLocaleId()
}

/**
* @return string
*
* @throws ExceptionInterface
*
* @return string
*/
public function getHref(UrlParameterBag $urlParameterBag, bool $catch = false)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Navigation/UrlParameterBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private function validateScalar($value): void
return;
}

if (!is_scalar($value)) {
if (!\is_scalar($value)) {
throw new \InvalidArgumentException('URL can only contain (array of) scalar values');
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/ecs/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"contao/easy-coding-standard": "^3.0"
"contao/easy-coding-standard": "^5.3"
},
"config": {
"allow-plugins": {
Expand Down
86 changes: 48 additions & 38 deletions tools/ecs/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 63ecac4

Please sign in to comment.