Skip to content
Snippets Groups Projects
Commit a57457a3 authored by Matthias Adrowski's avatar Matthias Adrowski
Browse files

[TASK] Various php8 fixes

parent b66fc8de
No related branches found
No related tags found
1 merge request!38Feature upgrade to typo3 11
...@@ -102,7 +102,7 @@ class OverviewController extends AbstractController { ...@@ -102,7 +102,7 @@ class OverviewController extends AbstractController {
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException
*/ */
public function initializeOverviewAction() { public function initializeOverviewAction() {
$currentPageBrowserPage = (int) GeneralUtility::_GP('tx_sgnews_pagebrowser')['currentPage']; $currentPageBrowserPage = (int) (GeneralUtility::_GP('tx_sgnews_pagebrowser')['currentPage'] ?? 0);
if ($currentPageBrowserPage > 0) { if ($currentPageBrowserPage > 0) {
$this->request->setArgument('currentPageBrowserPage', $currentPageBrowserPage); $this->request->setArgument('currentPageBrowserPage', $currentPageBrowserPage);
} }
...@@ -135,28 +135,28 @@ class OverviewController extends AbstractController { ...@@ -135,28 +135,28 @@ class OverviewController extends AbstractController {
} }
// Setup settings // Setup settings
$startTime = (int) $this->settings['starttime']; $startTime = (int) ($this->settings['starttime'] ?? 0);
$endTime = (int) $this->settings['endtime']; $endTime = (int) ($this->settings['endtime'] ?? 0);
$newsLimit = (int) $this->settings['newsLimit']; $newsLimit = (int) ($this->settings['newsLimit'] ?? 0);
$offset = $this->calculatePaginationOffset($currentPageBrowserPage, $newsLimit); $offset = $this->calculatePaginationOffset($currentPageBrowserPage, $newsLimit);
$configurationService = GeneralUtility::makeInstance(ConfigurationService::class); $configurationService = GeneralUtility::makeInstance(ConfigurationService::class);
$sortBy = $configurationService->getConfiguration('sortBy', $this->settings); $sortBy = $configurationService->getConfiguration('sortBy', $this->settings);
$sortDirection = $configurationService->getConfiguration('sortDirection', $this->settings); $sortDirection = $configurationService->getConfiguration('sortDirection', $this->settings);
$this->tagRepository->setDefaultOrderings(['sorting' => QueryInterface::ORDER_ASCENDING]); $this->tagRepository->setDefaultOrderings(['sorting' => QueryInterface::ORDER_ASCENDING]);
$this->categoryRepository->setDefaultOrderings(['sorting' => QueryInterface::ORDER_ASCENDING]); $this->categoryRepository->setDefaultOrderings(['sorting' => QueryInterface::ORDER_ASCENDING]);
$useAllFilters = (bool) $this->settings['enableFilter']; $useAllFilters = (bool) ($this->settings['enableFilter'] ?? false);
$isCategoryFiltered = $useAllFilters || (int) $this->settings['groupBy'] === 1; $isCategoryFiltered = $useAllFilters || $this->settings['groupBy'] === 1 ? 1: 0;
$isTagFiltered = $useAllFilters || (int) $this->settings['groupBy'] === 2; $isTagFiltered = $useAllFilters || $this->settings['groupBy'] === 2 ? 1: 0;
HeaderMetaDataService::addPageNumberToCanonical($currentPageBrowserPage); HeaderMetaDataService::addPageNumberToCanonical($currentPageBrowserPage);
// Get tag pid // Get tag pid
$tagPid = (int) $this->settings['tagPid']; $tagPid = (int) ($this->settings['tagPid'] ?? 0);
if (!$tagPid) { if (!$tagPid) {
$tagPid = $GLOBALS['TSFE']->id; $tagPid = $GLOBALS['TSFE']->id;
} }
if ($this->settings['onlyNewsWithinThisPageSection']) { if ($this->settings['onlyNewsWithinThisPageSection'] ?? false) {
$categories = $this->categoryRepository->findCategoriesInRootLine($GLOBALS['TSFE']->id); $categories = $this->categoryRepository->findCategoriesInRootLine($GLOBALS['TSFE']->id);
$tags = $this->tagRepository->findTagsInRootLine($tagPid); $tags = $this->tagRepository->findTagsInRootLine($tagPid);
} else { } else {
...@@ -165,7 +165,7 @@ class OverviewController extends AbstractController { ...@@ -165,7 +165,7 @@ class OverviewController extends AbstractController {
} }
// Apply category restrictions // Apply category restrictions
$categoryRestrictions = GeneralUtility::intExplode(',', $this->settings['categoryRestrictions'], TRUE); $categoryRestrictions = GeneralUtility::intExplode(',', $this->settings['categoryRestrictions'] ?? '', TRUE);
if (!$isCategoryFiltered) { if (!$isCategoryFiltered) {
$categoryRestrictions = []; $categoryRestrictions = [];
} }
...@@ -191,7 +191,7 @@ class OverviewController extends AbstractController { ...@@ -191,7 +191,7 @@ class OverviewController extends AbstractController {
} }
// Apply tag restrictions // Apply tag restrictions
$tagRestrictions = GeneralUtility::intExplode(',', $this->settings['tagRestrictions'], TRUE); $tagRestrictions = GeneralUtility::intExplode(',', $this->settings['tagRestrictions'] ?? '', TRUE);
if (!$isTagFiltered) { if (!$isTagFiltered) {
$tagRestrictions = []; $tagRestrictions = [];
} }
...@@ -205,7 +205,7 @@ class OverviewController extends AbstractController { ...@@ -205,7 +205,7 @@ class OverviewController extends AbstractController {
// Get category ids or use the one in the filter // Get category ids or use the one in the filter
$categoryIds = []; $categoryIds = [];
if ($newsFilter['category']) { if ($newsFilter['category'] ?? false) {
$categoryIds = [(int) $newsFilter['category']]; $categoryIds = [(int) $newsFilter['category']];
} elseif ($isCategoryFiltered) { } elseif ($isCategoryFiltered) {
foreach ($categories as $category) { foreach ($categories as $category) {
...@@ -217,7 +217,7 @@ class OverviewController extends AbstractController { ...@@ -217,7 +217,7 @@ class OverviewController extends AbstractController {
// Get tag ids or use the one in the filter // Get tag ids or use the one in the filter
$tagIds = []; $tagIds = [];
if ($newsFilter['tag']) { if ($newsFilter['tag'] ?? false) {
$tagIds = [(int) $newsFilter['tag']]; $tagIds = [(int) $newsFilter['tag']];
} elseif ($isTagFiltered) { } elseif ($isTagFiltered) {
foreach ($tags as $tag) { foreach ($tags as $tag) {
...@@ -302,8 +302,8 @@ class OverviewController extends AbstractController { ...@@ -302,8 +302,8 @@ class OverviewController extends AbstractController {
} }
// remember selection of the filter values, if any // remember selection of the filter values, if any
$selectedTag = $this->tagRepository->findByUid((int) $newsFilter['tag']); $selectedTag = $this->tagRepository->findByUid((int) ($newsFilter['tag'] ?? 0));
$selectedCategory = $this->categoryRepository->findByUid((int) $newsFilter['category']); $selectedCategory = $this->categoryRepository->findByUid((int) ($newsFilter['category'] ?? 0));
$this->view->assign('selectedCategory', $selectedCategory); $this->view->assign('selectedCategory', $selectedCategory);
$this->view->assign('selectedTag', $selectedTag); $this->view->assign('selectedTag', $selectedTag);
$this->view->assign('tags', $tags); $this->view->assign('tags', $tags);
...@@ -313,7 +313,7 @@ class OverviewController extends AbstractController { ...@@ -313,7 +313,7 @@ class OverviewController extends AbstractController {
$this->view->assign('allNews', $allNews); $this->view->assign('allNews', $allNews);
$this->setupGridColumns(); $this->setupGridColumns();
switch ($this->settings['groupBy']) { switch ($this->settings['groupBy'] ?? '') {
case 1: case 1:
$this->view->assign('groupBy', 'category'); $this->view->assign('groupBy', 'category');
$this->view->assign('categoryTabs', TRUE); $this->view->assign('categoryTabs', TRUE);
...@@ -369,8 +369,8 @@ class OverviewController extends AbstractController { ...@@ -369,8 +369,8 @@ class OverviewController extends AbstractController {
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException
*/ */
protected function highlightBestFitNews(array $categoryIds = NULL, array $tagIds = NULL) { protected function highlightBestFitNews(array $categoryIds = NULL, array $tagIds = NULL) {
$startTime = (int) $this->settings['starttime']; $startTime = (int) ($this->settings['starttime'] ?? 0);
$endTime = (int) $this->settings['endtime']; $endTime = (int) ($this->settings['endtime'] ?? 0);
/** @var News $highlightedNews */ /** @var News $highlightedNews */
$highlightedNews = $this->newsRepository $highlightedNews = $this->newsRepository
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment