Skip to content

Commit

Permalink
[REFACTOR] Run typo3 rector for TYPO3 v13
Browse files Browse the repository at this point in the history
  • Loading branch information
tinzog committed Dec 19, 2024
1 parent 3fe2096 commit f740403
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ protected function createFalDriver(array $storage): DriverInterface
$driver->setStorageUid($storage['uid']);

$capabilities =
($storage['is_browsable'] ?? null ? ResourceStorageInterface::CAPABILITY_BROWSABLE : 0)
| ($storage['is_public'] ?? null ? ResourceStorageInterface::CAPABILITY_PUBLIC : 0)
| ($storage['is_writable'] ?? null ? ResourceStorageInterface::CAPABILITY_WRITABLE : 0)
| ResourceStorageInterface::CAPABILITY_HIERARCHICAL_IDENTIFIERS;
($storage['is_browsable'] ?? null ? \TYPO3\CMS\Core\Resource\Capabilities::CAPABILITY_BROWSABLE : 0)
| ($storage['is_public'] ?? null ? \TYPO3\CMS\Core\Resource\Capabilities::CAPABILITY_PUBLIC : 0)
| ($storage['is_writable'] ?? null ? \TYPO3\CMS\Core\Resource\Capabilities::CAPABILITY_WRITABLE : 0)
| \TYPO3\CMS\Core\Resource\Capabilities::CAPABILITY_HIERARCHICAL_IDENTIFIERS;
$driver->mergeConfigurationCapabilities($capabilities);
$driver->processConfiguration();
$driver->initialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BackButton extends LinkButton
{
public function __construct(IconFactory $iconFactory, UriBuilder $uriBuilder)
{
$this->icon = $iconFactory->getIcon('actions-close', Icon::SIZE_SMALL);
$this->icon = $iconFactory->getIcon('actions-close', \TYPO3\CMS\Core\Imaging\IconSize::SMALL);
$this->href = $uriBuilder->reset()->uriFor('list');
$this->title = $GLOBALS['LANG']->sL('LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:back');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __toString(): string

public function render(): string
{
$icon = $this->iconFactory->getIcon('actions-document-synchronize', Icon::SIZE_SMALL)->render();
$icon = $this->iconFactory->getIcon('actions-document-synchronize', \TYPO3\CMS\Core\Imaging\IconSize::SMALL)->render();
$label = htmlspecialchars(LocalizationUtility::translate('save_and_publish', 'In2publishCore'));
return <<<HTML
<button name="_saveandpublish" class="btn btn-default btn-sm " value="1" title="Save" form="EditDocumentController">$icon $label</button>
Expand Down
2 changes: 1 addition & 1 deletion Classes/Features/RedirectsSupport/Domain/Dto/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function toAdditionWhere(): array
$where[] = 'target LIKE ' . $database->quote('%' . $this->target . '%');
}
if (null !== $this->code) {
$where[] = 'target_statuscode = ' . $database->quote($this->code);
$where[] = 'target_statuscode = ' . $database->quote((string) $this->code);
}
if (null !== $this->association) {
if ('present' === $this->association) {
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/File/IconViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function render(): string

$iconIdentifier = $this->getIconIdentifier($record);

return $this->iconFactory->getIcon($iconIdentifier, Icon::SIZE_SMALL)->render();
return $this->iconFactory->getIcon($iconIdentifier, \TYPO3\CMS\Core\Imaging\IconSize::SMALL)->render();
}

protected function getIconIdentifier(Record $record): ?string
Expand Down
13 changes: 4 additions & 9 deletions Classes/ViewHelpers/Format/DiffViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

class DiffViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;

protected $escapeOutput = false;
private const ARG_OLD = 'old';
private const ARG_NEW = 'new';
Expand All @@ -28,16 +26,13 @@ public function initializeArguments(): void
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public static function renderStatic(
array $arguments,
Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
): string {
public function render(): string
{
$diffUtility = GeneralUtility::makeInstance(DiffUtility::class);
$diffUtility->stripTags = false;
return $diffUtility->makeDiffDisplay(
(string)$arguments[self::ARG_OLD],
(string)$arguments[self::ARG_NEW],
(string)$this->arguments[self::ARG_OLD],
(string)$this->arguments[self::ARG_NEW],
);
}
}
6 changes: 3 additions & 3 deletions Classes/ViewHelpers/Record/LanguageFlagIconViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function render(): string

$languageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'] ?? null;
if (null === $languageField) {
return $this->iconFactory->getIcon('actions-pencil', Icon::SIZE_SMALL)->render();
return $this->iconFactory->getIcon('actions-pencil', \TYPO3\CMS\Core\Imaging\IconSize::SMALL)->render();
}

$systemLanguages = array_filter(
Expand All @@ -88,12 +88,12 @@ public function render(): string

$systemLanguage = $systemLanguages[$language] ?? null;
if (null === $systemLanguage) {
return $this->iconFactory->getIcon('flags-multiple', Icon::SIZE_SMALL, 'overlay-edit')->render();
return $this->iconFactory->getIcon('flags-multiple', \TYPO3\CMS\Core\Imaging\IconSize::SMALL, 'overlay-edit')->render();
}

return $this->iconFactory->getIcon(
$systemLanguage['flagIcon'],
Icon::SIZE_SMALL,
\TYPO3\CMS\Core\Imaging\IconSize::SMALL,
$overlay,
)->render();
}
Expand Down
15 changes: 4 additions & 11 deletions Classes/ViewHelpers/Tca/TableRowLabelViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

class TableRowLabelViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;

public function initializeArguments(): void
{
$this->registerArgument('table', 'string', 'The row\'s table', true);
Expand All @@ -24,16 +22,11 @@ public function initializeArguments(): void
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public static function renderStatic(
array $arguments,
Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
) {
public function render()
{
$tcaService = GeneralUtility::makeInstance(TcaService::class);

$table = (string)$arguments['table'];
$row = (array)$arguments['row'];

$table = (string)$this->arguments['table'];
$row = (array)$this->arguments['row'];
return $tcaService->getRecordLabel($row, $table);
}
}
1 change: 1 addition & 0 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
'Pi1',
[FrontendController::class => 'preview'],
[FrontendController::class => 'preview'],
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT,
);

/******************************************** Configure Garbage Collector ****************************************/
Expand Down

0 comments on commit f740403

Please sign in to comment.