diff --git a/typo3/sysext/lowlevel/Classes/Command/CleanFlexFormsCommand.php b/typo3/sysext/lowlevel/Classes/Command/CleanFlexFormsCommand.php index 555796db6e60463532ee46211373986fdb62081a..d7a9810bb99c50ae70d1cb4788de67e27bb3374b 100644 --- a/typo3/sysext/lowlevel/Classes/Command/CleanFlexFormsCommand.php +++ b/typo3/sysext/lowlevel/Classes/Command/CleanFlexFormsCommand.php @@ -36,14 +36,8 @@ use TYPO3\CMS\Core\Utility\MathUtility; */ class CleanFlexFormsCommand extends Command { - /** - * @var ConnectionPool - */ - private $connectionPool; - - public function __construct(ConnectionPool $connectionPool) + public function __construct(private readonly ConnectionPool $connectionPool) { - $this->connectionPool = $connectionPool; parent::__construct(); } @@ -99,8 +93,7 @@ class CleanFlexFormsCommand extends Command $io->section('Searching the database now for records with FlexForms that need to be updated.'); } - // Type unsafe comparison and explicit boolean setting on purpose - $dryRun = $input->hasOption('dry-run') && $input->getOption('dry-run') != false ? true : false; + $dryRun = $input->hasOption('dry-run') && (bool)$input->getOption('dry-run') !== false; // Find all records that should be updated $recordsToUpdate = $this->findAllDirtyFlexformsInPage($startingPoint, $depth); @@ -124,10 +117,6 @@ class CleanFlexFormsCommand extends Command /** * Recursive traversal of page tree - * - * @param int $pageId Page root id - * @param int $depth Depth - * @param array $dirtyFlexFormFields the list of all previously found flexform fields */ protected function findAllDirtyFlexformsInPage(int $pageId, int $depth, array $dirtyFlexFormFields = []): array { diff --git a/typo3/sysext/lowlevel/Classes/Command/DeletedRecordsCommand.php b/typo3/sysext/lowlevel/Classes/Command/DeletedRecordsCommand.php index 4df1dbdafd3eb7c75744fcac79f2c3474823f362..cfd4aa409075ba1dc26d748495c1a66fe798ed37 100644 --- a/typo3/sysext/lowlevel/Classes/Command/DeletedRecordsCommand.php +++ b/typo3/sysext/lowlevel/Classes/Command/DeletedRecordsCommand.php @@ -35,14 +35,8 @@ use TYPO3\CMS\Core\Utility\MathUtility; */ class DeletedRecordsCommand extends Command { - /** - * @var ConnectionPool - */ - private $connectionPool; - - public function __construct(ConnectionPool $connectionPool) + public function __construct(private readonly ConnectionPool $connectionPool) { - $this->connectionPool = $connectionPool; parent::__construct(); } @@ -111,8 +105,7 @@ class DeletedRecordsCommand extends Command $io->section('Searching the database now for deleted records.'); } - // type unsafe comparison and explicit boolean setting on purpose - $dryRun = $input->hasOption('dry-run') && $input->getOption('dry-run') != false ? true : false; + $dryRun = $input->hasOption('dry-run') && (bool)$input->getOption('dry-run') !== false; // find all records that should be deleted $deletedRecords = $this->findAllFlaggedRecordsInPage($startingPoint, $depth, $maximumTimestamp); @@ -284,10 +277,7 @@ class DeletedRecordsCommand extends Command } /** - * Fetches all tables registered in the TCA with a $flag - * and that are not pages (which are handled separately) - * - * @return array an associative array with the table as key and the + * Fetches all tables registered in the TCA with a $flag and that are not pages (which are handled separately). */ protected function getTablesWithFlag(string $flag): array { @@ -307,7 +297,7 @@ class DeletedRecordsCommand extends Command * @param array $deletedRecords two level array with tables and uids * @param bool $dryRun check if the records should NOT be deleted (use --dry-run to avoid) */ - protected function deleteRecords(array $deletedRecords, bool $dryRun, SymfonyStyle $io) + protected function deleteRecords(array $deletedRecords, bool $dryRun, SymfonyStyle $io): void { // Putting "pages" table in the bottom if (isset($deletedRecords['pages'])) { diff --git a/typo3/sysext/lowlevel/Classes/Command/MissingRelationsCommand.php b/typo3/sysext/lowlevel/Classes/Command/MissingRelationsCommand.php index adcf023c1bd6151fc59cc62249cdaabb184e08b1..ce6b26ded9aaac8d0a49eb40dd6ee8b848929295 100644 --- a/typo3/sysext/lowlevel/Classes/Command/MissingRelationsCommand.php +++ b/typo3/sysext/lowlevel/Classes/Command/MissingRelationsCommand.php @@ -43,16 +43,11 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; */ class MissingRelationsCommand extends Command { - /** - * @var ConnectionPool - */ - private $connectionPool; - - public function __construct(ConnectionPool $connectionPool) + public function __construct(private readonly ConnectionPool $connectionPool) { - $this->connectionPool = $connectionPool; parent::__construct(); } + /** * Configure the command by defining the name, options and arguments */ @@ -113,7 +108,7 @@ If you want to get more detailed information, use the --verbose option.') $io = new SymfonyStyle($input, $output); $io->title($this->getDescription()); - $dryRun = $input->hasOption('dry-run') && $input->getOption('dry-run') != false ? true : false; + $dryRun = $input->hasOption('dry-run') && (bool)$input->getOption('dry-run') !== false; // Update the reference index $this->updateReferenceIndex($input, $io); @@ -190,11 +185,8 @@ If you want to get more detailed information, use the --verbose option.') * - if the option --update-refindex is set, do it * - otherwise, if in interactive mode (not having -n set), ask the user * - otherwise assume everything is fine - * - * @param InputInterface $input holds information about entered parameters - * @param SymfonyStyle $io necessary for outputting information */ - protected function updateReferenceIndex(InputInterface $input, SymfonyStyle $io) + protected function updateReferenceIndex(InputInterface $input, SymfonyStyle $io): void { // Check for reference index to update $io->note('Finding missing records referenced by TYPO3 requires a clean reference index (sys_refindex)'); @@ -219,8 +211,6 @@ If you want to get more detailed information, use the --verbose option.') /** * Find relations pointing to non-existing records (in managed references or soft-references) - * - * @return array an array of records within sys_refindex */ protected function findRelationsToNonExistingRecords(): array { @@ -340,7 +330,7 @@ If you want to get more detailed information, use the --verbose option.') array $nonExistingRecords, bool $dryRun, SymfonyStyle $io - ) { + ): void { // Remove references to offline records foreach ($offlineVersionRecords as $fileName => $references) { if ($io->isVeryVerbose()) { diff --git a/typo3/sysext/lowlevel/Classes/Command/OrphanRecordsCommand.php b/typo3/sysext/lowlevel/Classes/Command/OrphanRecordsCommand.php index 91d5da18c9de0a75244cfbac74f53473e82f1ebe..009f465d29ba588a9ab860e1aa74d06f56b7bddf 100644 --- a/typo3/sysext/lowlevel/Classes/Command/OrphanRecordsCommand.php +++ b/typo3/sysext/lowlevel/Classes/Command/OrphanRecordsCommand.php @@ -34,16 +34,11 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; */ class OrphanRecordsCommand extends Command { - /** - * @var ConnectionPool - */ - private $connectionPool; - - public function __construct(ConnectionPool $connectionPool) + public function __construct(private readonly ConnectionPool $connectionPool) { - $this->connectionPool = $connectionPool; parent::__construct(); } + /** * Configure the command by defining the name, options and arguments */ @@ -86,8 +81,7 @@ Manual repair suggestions: $io->section('Searching the database now for orphaned records.'); } - // type unsafe comparison and explicit boolean setting on purpose - $dryRun = $input->hasOption('dry-run') && $input->getOption('dry-run') != false ? true : false; + $dryRun = $input->hasOption('dry-run') && (bool)$input->getOption('dry-run') !== false; // find all records that should be deleted $allRecords = $this->findAllConnectedRecordsInPage(0, 10000); @@ -240,7 +234,7 @@ Manual repair suggestions: * @param array $orphanedRecords two level array with tables and uids * @param bool $dryRun check if the records should NOT be deleted (use --dry-run to avoid) */ - protected function deleteRecords(array $orphanedRecords, bool $dryRun, SymfonyStyle $io) + protected function deleteRecords(array $orphanedRecords, bool $dryRun, SymfonyStyle $io): void { // Putting "pages" table in the bottom if (isset($orphanedRecords['pages'])) { diff --git a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/BackendRoutesProvider.php b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/BackendRoutesProvider.php index dcfaacb1e1314554d3d9aad6553b148c2d9160d5..58a3062cd3afbcd735c382e8a640c311ead2189a 100644 --- a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/BackendRoutesProvider.php +++ b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/BackendRoutesProvider.php @@ -24,11 +24,8 @@ use TYPO3\CMS\Core\Utility\ArrayUtility; class BackendRoutesProvider extends AbstractProvider { - protected Router $router; - - public function __construct(Router $router) + public function __construct(protected readonly Router $router) { - $this->router = $router; } public function getConfiguration(): array diff --git a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/EventListenersProvider.php b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/EventListenersProvider.php index 134e3d4ef69a593759274cdd3e7dba11074e76b0..aae48d3ae603db782f1e48b4498984633f00c819 100644 --- a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/EventListenersProvider.php +++ b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/EventListenersProvider.php @@ -21,11 +21,8 @@ use TYPO3\CMS\Core\EventDispatcher\ListenerProvider; class EventListenersProvider extends AbstractProvider { - protected ListenerProvider $listenerProvider; - - public function __construct(ListenerProvider $listenerProvider) + public function __construct(protected readonly ListenerProvider $listenerProvider) { - $this->listenerProvider = $listenerProvider; } public function getConfiguration(): array diff --git a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/HttpMiddlewareStackProvider.php b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/HttpMiddlewareStackProvider.php index 2a2b31f76c2021636d9acb815e2d2c628a4094c4..f70443ba9ce46e0721ab80fa0c089eb484262a48 100644 --- a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/HttpMiddlewareStackProvider.php +++ b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/HttpMiddlewareStackProvider.php @@ -21,11 +21,8 @@ use Psr\Container\ContainerInterface; class HttpMiddlewareStackProvider extends AbstractProvider { - protected ContainerInterface $container; - - public function __construct(ContainerInterface $container) + public function __construct(protected readonly ContainerInterface $container) { - $this->container = $container; } public function getConfiguration(): array diff --git a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/MfaProvidersProvider.php b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/MfaProvidersProvider.php index 90de802d2253fb2fc024d90d7bb150b3535235c3..6476d5b92822a83fc315bbb2ee9a12ee973263d5 100644 --- a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/MfaProvidersProvider.php +++ b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/MfaProvidersProvider.php @@ -21,11 +21,8 @@ use TYPO3\CMS\Core\Authentication\Mfa\MfaProviderRegistry; class MfaProvidersProvider extends AbstractProvider { - protected MfaProviderRegistry $mfaProviderRegistry; - - public function __construct(MfaProviderRegistry $mfaProviderRegistry) + public function __construct(protected MfaProviderRegistry $mfaProviderRegistry) { - $this->mfaProviderRegistry = $mfaProviderRegistry; } public function getConfiguration(): array diff --git a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ProviderInterface.php b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ProviderInterface.php index b80b2a625e43c41404d8025a004a2fb794eabfa2..01629aa0adc63afacbad62db6079518472a6996e 100644 --- a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ProviderInterface.php +++ b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ProviderInterface.php @@ -29,7 +29,6 @@ interface ProviderInterface * Note: We use __invoke so provider implementations are still * able to use dependency injection via constructor arguments. * - * @param array $attributes * @return $this */ public function __invoke(array $attributes): self; diff --git a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ProviderRegistry.php b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ProviderRegistry.php index 2e9ed598ebb3812f1cdefa4e6215386f7c36ee81..468d92a7348da7501283fcf15ae12ccad9e03d08 100644 --- a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ProviderRegistry.php +++ b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ProviderRegistry.php @@ -32,9 +32,9 @@ final class ProviderRegistry $this->providers[$attributes['identifier']] = $provider($attributes); } - public function hasProvider(string $identifer): bool + public function hasProvider(string $identifier): bool { - return isset($this->providers[$identifer]); + return isset($this->providers[$identifier]); } public function getProvider(string $identifier): ProviderInterface diff --git a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/SoftReferenceParsersProvider.php b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/SoftReferenceParsersProvider.php index b606832181ae3ec602d1cd43439a316a27b6a027..76efcce8adc163f0c2a077e50cdfceef41e3b8d3 100644 --- a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/SoftReferenceParsersProvider.php +++ b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/SoftReferenceParsersProvider.php @@ -21,11 +21,8 @@ use TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserFactory; class SoftReferenceParsersProvider extends AbstractProvider { - protected SoftReferenceParserFactory $softReferenceParserFactory; - - public function __construct(SoftReferenceParserFactory $softReferenceParserFactory) + public function __construct(protected SoftReferenceParserFactory $softReferenceParserFactory) { - $this->softReferenceParserFactory = $softReferenceParserFactory; } public function getConfiguration(): array diff --git a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ToolbarItemsProvider.php b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ToolbarItemsProvider.php index 1a697151f2495c219eb010cb07eea3093efc007e..68e37e5cbc3e9c069c212331e67f3ada3498c6cd 100644 --- a/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ToolbarItemsProvider.php +++ b/typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ToolbarItemsProvider.php @@ -21,11 +21,8 @@ use TYPO3\CMS\Backend\Toolbar\ToolbarItemsRegistry; class ToolbarItemsProvider extends AbstractProvider { - protected ToolbarItemsRegistry $toolbarItemsRegistry; - - public function __construct(ToolbarItemsRegistry $toolbarItemsRegistry) + public function __construct(protected readonly ToolbarItemsRegistry $toolbarItemsRegistry) { - $this->toolbarItemsRegistry = $toolbarItemsRegistry; } public function getConfiguration(): array diff --git a/typo3/sysext/lowlevel/Classes/Controller/DatabaseIntegrityController.php b/typo3/sysext/lowlevel/Classes/Controller/DatabaseIntegrityController.php index c919db7627561317cabb326fbb71d0566eacc60c..cc0f5a57e211920ccdfd6336cdcc62e6f5447fc8 100644 --- a/typo3/sysext/lowlevel/Classes/Controller/DatabaseIntegrityController.php +++ b/typo3/sysext/lowlevel/Classes/Controller/DatabaseIntegrityController.php @@ -71,10 +71,6 @@ class DatabaseIntegrityController */ protected array $MOD_SETTINGS = []; - protected IconFactory $iconFactory; - protected UriBuilder $uriBuilder; - protected ModuleTemplateFactory $moduleTemplateFactory; - protected string $formName = ''; protected string $moduleName = ''; @@ -220,13 +216,10 @@ class DatabaseIntegrityController ]; public function __construct( - IconFactory $iconFactory, - UriBuilder $uriBuilder, - ModuleTemplateFactory $moduleTemplateFactory + protected IconFactory $iconFactory, + protected readonly UriBuilder $uriBuilder, + protected readonly ModuleTemplateFactory $moduleTemplateFactory ) { - $this->iconFactory = $iconFactory; - $this->uriBuilder = $uriBuilder; - $this->moduleTemplateFactory = $moduleTemplateFactory; $this->moduleName = 'system_dbint'; } @@ -620,7 +613,7 @@ class DatabaseIntegrityController if ($id < 0) { $id = abs($id); } - if ($begin == 0) { + if ($begin === 0) { $theList = (string)$id; } else { $theList = ''; @@ -749,7 +742,7 @@ class DatabaseIntegrityController /** * @param array|null $row Table columns */ - protected function resultRowTitles($row, array $conf): string + protected function resultRowTitles(?array $row, array $conf): string { $languageService = $this->getLanguageService(); $tableHeader = []; @@ -1061,7 +1054,7 @@ class DatabaseIntegrityController $tablePrefix = ''; $labelFieldSelect = []; foreach ($from_table_Arr as $from_table) { - if ($useTablePrefix && !$dontPrefixFirstTable && $counter != 1 || $counter == 1) { + if ($useTablePrefix && !$dontPrefixFirstTable && $counter !== 1 || $counter === 1) { $tablePrefix = $from_table . '_'; } $counter = 1; @@ -1298,10 +1291,8 @@ class DatabaseIntegrityController /** * Checks if the given value is of the ISO 8601 format. - * - * @param mixed $date */ - protected function isDateOfIso8601Format($date): bool + protected function isDateOfIso8601Format(mixed $date): bool { if (!is_int($date) && !is_string($date)) { return false; @@ -1807,7 +1798,7 @@ class DatabaseIntegrityController foreach ($from_table_Arr as $from_table) { $useSelectLabels = false; $useAltSelectLabels = false; - if ($useTablePrefix && !$dontPrefixFirstTable && $counter != 1 || $counter === 1) { + if ($useTablePrefix && !$dontPrefixFirstTable && $counter !== 1 || $counter === 1) { $tablePrefix = $from_table . '_'; } $counter = 1;