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