Skip to content

Commit

Permalink
fix: rector rule
Browse files Browse the repository at this point in the history
  • Loading branch information
jackd248 committed Nov 12, 2024
1 parent 099aa2d commit 1638703
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
3 changes: 2 additions & 1 deletion Classes/Domain/Model/Dto/CommentItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Xima\XimaTypo3ContentPlanner\Domain\Model\Dto;

use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use Xima\XimaTypo3ContentPlanner\Domain\Model\Status;
Expand Down Expand Up @@ -55,7 +56,7 @@ public function getRecordIcon(): string
if (!$this->getRelatedRecord()) {
return '';
}
return $iconFactory->getIconForRecord($this->data['foreign_table'], $this->getRelatedRecord(), \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value)->getIdentifier();
return $iconFactory->getIconForRecord($this->data['foreign_table'], $this->getRelatedRecord(), Icon::SIZE_SMALL)->getIdentifier();
}

public function getRecordLink(): string
Expand Down
16 changes: 8 additions & 8 deletions Classes/Domain/Model/Dto/HistoryItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function getPid(): int

public function getTitle(): ?string
{
return $this->getRelatedRecord()['title'] ?: $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.no_title');
return array_key_exists('title', $this->getRelatedRecord()) ? $this->getRelatedRecord()['title'] : $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.no_title');
}

public function getRelatedRecord(): array|bool
Expand Down Expand Up @@ -97,14 +97,14 @@ public function getStatusIcon(): ?string
{
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$status = ContentUtility::getStatus($this->getRelatedRecord()['tx_ximatypo3contentplanner_status']);
return $this->renderIcon($iconFactory->getIcon($status ? $status->getColoredIcon() : 'flag-gray', \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value));
return $this->renderIcon($iconFactory->getIcon($status ? $status->getColoredIcon() : 'flag-gray', Icon::SIZE_SMALL));
}

public function getRecordIcon(): string
{
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$record = $this->getRelatedRecord();
return $record ? $this->renderIcon($iconFactory->getIconForRecord($this->data['relatedRecordTablename'], $record, \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value)) : '';
return $record ? $this->renderIcon($iconFactory->getIconForRecord($this->data['relatedRecordTablename'], $record, Icon::SIZE_SMALL)) : '';
}

public function getTimeAgo(): string
Expand All @@ -122,7 +122,7 @@ public function getChangeTypeIcon(): string
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
switch ($this->data['tablename']) {
case 'tx_ximatypo3contentplanner_comment':
return $this->renderIcon($iconFactory->getIcon('actions-comment', \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value));
return $this->renderIcon($iconFactory->getIcon('actions-comment', Icon::SIZE_SMALL));
default:
if (!ExtensionUtility::isRegisteredRecordTable($this->data['tablename'])) {
break;
Expand All @@ -131,15 +131,15 @@ public function getChangeTypeIcon(): string
case 'tx_ximatypo3contentplanner_status':
$status = ContentUtility::getStatus((int)$this->data['raw_history']['newRecord']['tx_ximatypo3contentplanner_status']);
if (!$status) {
return $this->renderIcon($iconFactory->getIcon('flag-gray', \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value));
return $this->renderIcon($iconFactory->getIcon('flag-gray', Icon::SIZE_SMALL));
}
return $this->renderIcon($iconFactory->getIcon($status->getColoredIcon(), \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value));
return $this->renderIcon($iconFactory->getIcon($status->getColoredIcon(), Icon::SIZE_SMALL));
case 'tx_ximatypo3contentplanner_assignee':
return $this->renderIcon($iconFactory->getIcon('actions-user', \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value));
return $this->renderIcon($iconFactory->getIcon('actions-user', Icon::SIZE_SMALL));
}
break;
}
return $this->renderIcon($iconFactory->getIcon('actions-open', \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value));
return $this->renderIcon($iconFactory->getIcon('actions-open', Icon::SIZE_SMALL));
}

public function getRawHistoryData(): array
Expand Down
3 changes: 2 additions & 1 deletion Classes/Domain/Model/Dto/StatusItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use TYPO3\CMS\Backend\Backend\Avatar\Avatar;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
Expand Down Expand Up @@ -50,7 +51,7 @@ public function getStatusIcon(): string
public function getRecordIcon(): string
{
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
return $iconFactory->getIconForRecord($this->data['tablename'], $this->data, \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value)->render();
return $iconFactory->getIconForRecord($this->data['tablename'], $this->data, Icon::SIZE_SMALL)->render();
}

public function getRecordLink(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use TYPO3\CMS\Backend\RecordList\Event\ModifyRecordListRecordActionsEvent;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Localization\LanguageService;
use Xima\XimaTypo3ContentPlanner\Configuration;
Expand Down Expand Up @@ -45,7 +46,7 @@ public function __invoke(ModifyRecordListRecordActionsEvent $event): void
$icon = $status ? $status->getColoredIcon() : 'flag-gray';
$action = '<div class="btn-group" style="margin-left:10px;">
<a href="#" class="btn btn-default dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" title="' . $title . '">'
. $this->iconFactory->getIcon($icon, \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value)->render() . '</a><ul class="dropdown-menu">';
. $this->iconFactory->getIcon($icon, Icon::SIZE_SMALL)->render() . '</a><ul class="dropdown-menu">';

foreach ($this->statusRepository->findAll() as $statusEntry) {
$url = $this->uriBuilder->buildUriFromRoute(
Expand All @@ -67,7 +68,7 @@ public function __invoke(ModifyRecordListRecordActionsEvent $event): void
]
);
$action .= '<li><a class="dropdown-item dropdown-item-spaced" href="' . htmlspecialchars($url) . '" title="' . $statusEntry->getTitle() . '">'
. $this->iconFactory->getIcon($statusEntry->getColoredIcon(), \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value)->render() . $statusEntry->getTitle() . '</a></li>';
. $this->iconFactory->getIcon($statusEntry->getColoredIcon(), Icon::SIZE_SMALL)->render() . $statusEntry->getTitle() . '</a></li>';
}
$action .= '<li><hr class="dropdown-divider"></li>';
$url = $this->uriBuilder->buildUriFromRoute(
Expand All @@ -89,7 +90,7 @@ public function __invoke(ModifyRecordListRecordActionsEvent $event): void
]
);
$action .= '<li><a class="dropdown-item dropdown-item-spaced" href="' . htmlspecialchars($url) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:xima_typo3_content_planner/Resources/Private/Language/locallang_be.xlf:reset') . '">'
. $this->iconFactory->getIcon('actions-close', \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value)->render() . $this->getLanguageService()->sL('LLL:EXT:xima_typo3_content_planner/Resources/Private/Language/locallang_be.xlf:reset') . '</a></li>';
. $this->iconFactory->getIcon('actions-close', Icon::SIZE_SMALL)->render() . $this->getLanguageService()->sL('LLL:EXT:xima_typo3_content_planner/Resources/Private/Language/locallang_be.xlf:reset') . '</a></li>';
$action .= '</ul>';

if ((bool)$record['tx_ximatypo3contentplanner_assignee']) {
Expand All @@ -98,7 +99,7 @@ public function __invoke(ModifyRecordListRecordActionsEvent $event): void
}
if ((bool)$record['tx_ximatypo3contentplanner_comments']) {
$action .= '
<a class="btn btn-default" title="' . $title . '" href="' . $this->getEditUrl($table, $uid) . '">' . $this->iconFactory->getIcon('content-message', \TYPO3\CMS\Core\Imaging\IconSize::SMALL->value)->render() . ' ' . $record['tx_ximatypo3contentplanner_comments'] . '</a>';
<a class="btn btn-default" title="' . $title . '" href="' . $this->getEditUrl($table, $uid) . '">' . $this->iconFactory->getIcon('content-message', Icon::SIZE_SMALL)->render() . ' ' . $record['tx_ximatypo3contentplanner_comments'] . '</a>';
}
$action .= '</div>';
$event->setAction(
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
->withSets([
Typo3SetList::CODE_QUALITY,
Typo3SetList::GENERAL,
Typo3LevelSetList::UP_TO_TYPO3_13,
Typo3LevelSetList::UP_TO_TYPO3_12,
])
// To have a better analysis from PHPStan, we teach it here some more things
->withPHPStanConfigs([
Expand Down

0 comments on commit 1638703

Please sign in to comment.