diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index d4f758f..2d116c5 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -1,5 +1,10 @@ parameters: ignoreErrors: + - + message: "#^Attribute class TYPO3\\\\CMS\\\\Core\\\\Attribute\\\\AsEventListener does not exist\\.$#" + count: 1 + path: ../../Classes/EventListener/LinkValidator/CheckExternalLinksToLocalPagesEventListener.php + - message: "#^Access to an undefined property T3docs\\\\Examples\\\\Xclass\\\\NewRecordController\\:\\:\\$content\\.$#" count: 1 diff --git a/Build/phpstan/phpstan.neon b/Build/phpstan/phpstan.neon index 3970935..7b6f6b7 100644 --- a/Build/phpstan/phpstan.neon +++ b/Build/phpstan/phpstan.neon @@ -3,7 +3,7 @@ includes: parameters: phpVersion: 80200 - level: 1 + level: 2 bootstrapFiles: - phpstan-typo3-constants.php diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php index 97b9334..b8ab825 100644 --- a/Classes/Controller/ModuleController.php +++ b/Classes/Controller/ModuleController.php @@ -158,7 +158,7 @@ public function treeAction(): ResponseInterface ); // Create and initialize the tree object - /** @var $tree PageTreeView */ + /** @var PageTreeView $tree */ $tree = GeneralUtility::makeInstance(PageTreeView::class); $tree->init('AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1)); $html = ''; @@ -248,7 +248,7 @@ public function clipboardAction( */ protected function getClipboard(string $identifier): array { - /** @var $clipboard Clipboard */ + /** @var Clipboard $clipboard */ $clipboard = GeneralUtility::makeInstance(Clipboard::class); // Read the clipboard content from the user session $clipboard->initializeClipboard(); @@ -266,7 +266,7 @@ protected function getClipboard(string $identifier): array */ protected function getCurrentClipboard(): array { - /** @var $clipboard Clipboard */ + /** @var Clipboard $clipboard */ $clipboard = GeneralUtility::makeInstance(Clipboard::class); // Read the clipboard content from the user session $clipboard->initializeClipboard(); @@ -283,7 +283,7 @@ protected function getCurrentClipboard(): array */ protected function debugClipboard() { - /** @var $clipboard Clipboard */ + /** @var Clipboard $clipboard */ $clipboard = GeneralUtility::makeInstance(Clipboard::class); // Read the clipboard content from the user session $clipboard->initializeClipboard(); @@ -368,7 +368,7 @@ public function linksAction(): ResponseInterface * * @param int $element Uid of the just processed content element (see fileReferenceCreateAction) */ - public function fileReferenceAction($element = 0): ResponseInterface + public function fileReferenceAction(int $element = 0): ResponseInterface { // Get all non-deleted content elements (this should normally be put away in a nice, clean // repository class; don't do this at home). @@ -385,11 +385,12 @@ public function fileReferenceAction($element = 0): ResponseInterface } catch (\Exception) { $contentElements = []; } + $files = []; // If we just handled a content element, get related data to display as a confirmation - if ((int)$element > 0) { + if ($element > 0) { $contentElement = BackendUtility::getRecord( 'tt_content', - (int)$element, + $element, ); try { $fileObjects = $this->fileRepository->findByRelation( @@ -397,6 +398,7 @@ public function fileReferenceAction($element = 0): ResponseInterface 'image', $element, ); + $files = $this->fileRepository->findByRelation('tt_content', 'image', $element); } catch (\Exception) { $fileObjects = []; } @@ -407,7 +409,7 @@ public function fileReferenceAction($element = 0): ResponseInterface $view = $this->initializeModuleTemplate($this->request); $view->assignMultiple( [ - 'files' => $this->fileRepository->findAll(), + 'files' => $files, 'elements' => $contentElements, 'content' => $contentElement, 'references' => $fileObjects,