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

[TASK] First batch of phpstan issues

parent 26b0bd11
No related branches found
No related tags found
1 merge request!38Feature upgrade to typo3 11
...@@ -96,7 +96,7 @@ class MigrateNewsCommandController extends Command { ...@@ -96,7 +96,7 @@ class MigrateNewsCommandController extends Command {
* *
* @param InputInterface $input * @param InputInterface $input
* @param OutputInterface $output * @param OutputInterface $output
* @return void * @return int
* @throws \JsonException * @throws \JsonException
*/ */
public function execute(InputInterface $input, OutputInterface $output) { public function execute(InputInterface $input, OutputInterface $output) {
...@@ -124,7 +124,7 @@ class MigrateNewsCommandController extends Command { ...@@ -124,7 +124,7 @@ class MigrateNewsCommandController extends Command {
->where( ->where(
$queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pId, Connection::PARAM_INT)) $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pId, Connection::PARAM_INT))
) )
->execute()->fetchAll(); ->execute()->fetchAllAssociative();
$localDataHandler = GeneralUtility::makeInstance(DataHandler::class); $localDataHandler = GeneralUtility::makeInstance(DataHandler::class);
Bootstrap::initializeBackendAuthentication(); Bootstrap::initializeBackendAuthentication();
$localCommandMap = [ $localCommandMap = [
...@@ -166,7 +166,7 @@ class MigrateNewsCommandController extends Command { ...@@ -166,7 +166,7 @@ class MigrateNewsCommandController extends Command {
$newsPage->setLastUpdated($date); $newsPage->setLastUpdated($date);
$this->setMatchingTag($row); $this->setMatchingTag($row);
/** @var File $image */ /** @var File $file */
$file = $this->getMatchingFile($row); $file = $this->getMatchingFile($row);
if ($file instanceof File) { if ($file instanceof File) {
$teaserImage1 = $fileReferenceRepository->addFileReferenceFromFile( $teaserImage1 = $fileReferenceRepository->addFileReferenceFromFile(
...@@ -222,6 +222,7 @@ class MigrateNewsCommandController extends Command { ...@@ -222,6 +222,7 @@ class MigrateNewsCommandController extends Command {
$this->updateTranslation($row); $this->updateTranslation($row);
} }
} }
return Command::SUCCESS;
} }
/** /**
...@@ -252,7 +253,7 @@ class MigrateNewsCommandController extends Command { ...@@ -252,7 +253,7 @@ class MigrateNewsCommandController extends Command {
) )
) )
) )
->execute()->fetch(); ->execute()->fetchAssociative();
if (!$fileReferenceResult) { if (!$fileReferenceResult) {
return NULL; return NULL;
} }
...@@ -269,7 +270,7 @@ class MigrateNewsCommandController extends Command { ...@@ -269,7 +270,7 @@ class MigrateNewsCommandController extends Command {
$queryBuilder->createNamedParameter($fileReferenceResult['uid_local'], Connection::PARAM_INT) $queryBuilder->createNamedParameter($fileReferenceResult['uid_local'], Connection::PARAM_INT)
) )
) )
->execute()->fetch(); ->execute()->fetchAssociative();
if (!$fileResult) { if (!$fileResult) {
return NULL; return NULL;
} }
...@@ -302,7 +303,7 @@ class MigrateNewsCommandController extends Command { ...@@ -302,7 +303,7 @@ class MigrateNewsCommandController extends Command {
$queryBuilder->createNamedParameter($row['uid'], Connection::PARAM_INT) $queryBuilder->createNamedParameter($row['uid'], Connection::PARAM_INT)
) )
) )
->execute()->fetchAll(); ->execute()->fetchAllAssociative();
foreach ($mmRows as $mmRow) { foreach ($mmRows as $mmRow) {
$values = [ $values = [
'uid_local' => $this->categoryMap[(int) $mmRow['uid_local']], 'uid_local' => $this->categoryMap[(int) $mmRow['uid_local']],
...@@ -385,7 +386,7 @@ class MigrateNewsCommandController extends Command { ...@@ -385,7 +386,7 @@ class MigrateNewsCommandController extends Command {
$queryBuilder->createNamedParameter($parentId, Connection::PARAM_INT) $queryBuilder->createNamedParameter($parentId, Connection::PARAM_INT)
) )
) )
->execute()->fetch(); ->execute()->fetchAssociative();
if ($result) { if ($result) {
$queryBuilder->where( $queryBuilder->where(
$queryBuilder->expr()->eq( $queryBuilder->expr()->eq(
......
...@@ -79,7 +79,7 @@ abstract class AbstractController extends ActionController { ...@@ -79,7 +79,7 @@ abstract class AbstractController extends ActionController {
* @throws \RuntimeException * @throws \RuntimeException
*/ */
public function errorAction() { public function errorAction() {
throw new RuntimeException(parent::errorAction()); throw new RuntimeException($this->getFlattenedValidationErrorMessage());
} }
/** /**
......
...@@ -58,7 +58,7 @@ class LatestController extends AbstractController { ...@@ -58,7 +58,7 @@ class LatestController extends AbstractController {
* *
* @param array $newsMetaData * @param array $newsMetaData
* @param int $offset * @param int $offset
* @return void * @return null|\Psr\Http\Message\ResponseInterface
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException
* @throws \TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException * @throws \TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException
......
...@@ -99,7 +99,7 @@ class ListByCategoryController extends AbstractController { ...@@ -99,7 +99,7 @@ class ListByCategoryController extends AbstractController {
* *
* @param array $newsMetaData * @param array $newsMetaData
* @param int $currentPageBrowserPage * @param int $currentPageBrowserPage
* @return void * @return null|\Psr\Http\Message\ResponseInterface
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException
* @throws \TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException * @throws \TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException
......
...@@ -44,7 +44,7 @@ class NewsByAuthorController extends AbstractController { ...@@ -44,7 +44,7 @@ class NewsByAuthorController extends AbstractController {
* Renders the news author list. * Renders the news author list.
* *
* @param int $authorId * @param int $authorId
* @return void * @return null|\Psr\Http\Message\ResponseInterface
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException
* @throws \TYPO3\CMS\Core\Package\Exception * @throws \TYPO3\CMS\Core\Package\Exception
......
...@@ -43,7 +43,7 @@ class NewsFeedController extends AbstractController { ...@@ -43,7 +43,7 @@ class NewsFeedController extends AbstractController {
/** /**
* Renders the news feed * Renders the news feed
* *
* @return void * @return null|\Psr\Http\Message\ResponseInterface
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException
*/ */
public function indexAction(): ?\Psr\Http\Message\ResponseInterface { public function indexAction(): ?\Psr\Http\Message\ResponseInterface {
......
...@@ -485,7 +485,7 @@ class OverviewController extends AbstractController { ...@@ -485,7 +485,7 @@ class OverviewController extends AbstractController {
$categoriesById = []; $categoriesById = [];
$newsMetaData = []; $newsMetaData = [];
foreach ($tags as $tag) { foreach ($tags as $tag) {
/** @var $tag Tag */ /** @var Tag $tag */
$tagId = $tag->getUid(); $tagId = $tag->getUid();
$tagIds[] = $tagId; $tagIds[] = $tagId;
$tagsById[$tagId] = $tag; $tagsById[$tagId] = $tag;
...@@ -625,7 +625,7 @@ class OverviewController extends AbstractController { ...@@ -625,7 +625,7 @@ class OverviewController extends AbstractController {
* @param array $newsMetaData * @param array $newsMetaData
* @param array|null $newsFilter * @param array|null $newsFilter
* @param int $currentPageBrowserPage * @param int $currentPageBrowserPage
* @return void * @return null|\Psr\Http\Message\ResponseInterface
* @throws ImmediateResponseException * @throws ImmediateResponseException
* @throws \TYPO3\CMS\Core\Error\Http\PageNotFoundException * @throws \TYPO3\CMS\Core\Error\Http\PageNotFoundException
* @throws \TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException * @throws \TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException
......
...@@ -62,12 +62,12 @@ class SingleViewController extends AbstractController { ...@@ -62,12 +62,12 @@ class SingleViewController extends AbstractController {
/** /**
* Renders the news single view * Renders the news single view
* *
* @return void * @return null|\Psr\Http\Message\ResponseInterface
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function singleViewAction(): ?\Psr\Http\Message\ResponseInterface { public function singleViewAction(): ?\Psr\Http\Message\ResponseInterface {
/** @var News $news */
$currentId = (int) $GLOBALS['TSFE']->id; $currentId = (int) $GLOBALS['TSFE']->id;
/** @var News $news */
$news = $this->newsRepository->findByUid($currentId); $news = $this->newsRepository->findByUid($currentId);
if (!$news) { if (!$news) {
if (version_compare( if (version_compare(
......
...@@ -60,7 +60,7 @@ class CategoryRepository extends AbstractRepository { ...@@ -60,7 +60,7 @@ class CategoryRepository extends AbstractRepository {
$queryBuilder->expr()->eq('translation.uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)) $queryBuilder->expr()->eq('translation.uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT))
) )
->setMaxResults(1) ->setMaxResults(1)
->execute()->fetch(); ->execute()->fetchAssociative();
if ($row && (int) $row['uid'] !== 0) { if ($row && (int) $row['uid'] !== 0) {
return current($dataMapper->map($this->objectType, [$row])); return current($dataMapper->map($this->objectType, [$row]));
} }
......
...@@ -70,7 +70,7 @@ class FileReferenceRepository extends AbstractRepository { ...@@ -70,7 +70,7 @@ class FileReferenceRepository extends AbstractRepository {
* extbase can not handle the default TCA for FAL records. Without this method the FAL records will miss * extbase can not handle the default TCA for FAL records. Without this method the FAL records will miss
* the uid_foreign, field name and table names. * the uid_foreign, field name and table names.
* *
* @param $fileId * @param int $fileId
* @param array $reference * @param array $reference
* @param string $tablename * @param string $tablename
* @param string $fieldname * @param string $fieldname
......
...@@ -524,7 +524,7 @@ class NewsRepository extends AbstractRepository { ...@@ -524,7 +524,7 @@ class NewsRepository extends AbstractRepository {
*/ */
public function findByUidIgnoreEnableFields($uid) { public function findByUidIgnoreEnableFields($uid) {
$query = $this->createQuery(); $query = $this->createQuery();
/** @var $querySettings \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings */ /** @var \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings $querySettings */
$querySettings = $query->getQuerySettings(); $querySettings = $query->getQuerySettings();
$querySettings->setIgnoreEnableFields(TRUE); $querySettings->setIgnoreEnableFields(TRUE);
$querySettings->setRespectStoragePage(FALSE); $querySettings->setRespectStoragePage(FALSE);
......
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