diff --git a/Classes/Middleware/ZabbixClient.php b/Classes/Middleware/ZabbixClient.php index 11f4931..c2f85e3 100644 --- a/Classes/Middleware/ZabbixClient.php +++ b/Classes/Middleware/ZabbixClient.php @@ -21,7 +21,6 @@ use Psr\Http\Server\MiddlewareInterface; use TYPO3\CMS\Core\TypoScript\AST\Node\RootNode; use TYPO3\CMS\Core\TypoScript\FrontendTypoScript; -use TYPO3\CMS\Core\Utility\DebugUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; @@ -98,7 +97,7 @@ private function processRequest(ServerRequestInterface $request) } catch (InvalidOperationException $ex){ return $response->withStatus(404, $ex->getMessage()); } catch (\Exception $ex) { - return $response->withStatus(500, substr(strrchr(get_class($ex), "\\"), 1) . ': '. $ex->getMessage()); + return $response->withStatus(500, get_class($ex) . ': '. $ex->getMessage()); } } diff --git a/Classes/Operation/CheckPathExists.php b/Classes/Operation/CheckPathExists.php index a0124fc..584de7d 100644 --- a/Classes/Operation/CheckPathExists.php +++ b/Classes/Operation/CheckPathExists.php @@ -27,10 +27,10 @@ class CheckPathExists implements IOperation, SingletonInterface /** * execute operation (checkPathExists) * - * @param array $parameter a path 'path' to a file or folder + * @param array|null $parameter a path 'path' to a file or folder * @return OperationResult 'file' if path is a file, 'directory' if it's a directory and false if it doesn't exist */ - public function execute($parameter = null) + public function execute(array $parameter = null): OperationResult { $path = $this->getPath($parameter['path']); list($path) = glob($path); @@ -61,9 +61,9 @@ public function execute($parameter = null) * prepare path, resolve relative path and resolve EXT: path * * @param string $path absolute or relative path or EXT:foobar/ - * @return string/bool false if path is invalid, else the absolute path + * @return false|string false if path is invalid, else the absolute path */ - protected function getPath($path) + protected function getPath($path): false|string { // getFileAbsFileName can't handle directory path with trailing / correctly if (substr($path, -1) === '/') { diff --git a/Classes/Operation/Extension/PageSpeedInsights/GetDegradedPageUids.php b/Classes/Operation/Extension/PageSpeedInsights/GetDegradedPageUids.php index e3ff510..5dc640d 100644 --- a/Classes/Operation/Extension/PageSpeedInsights/GetDegradedPageUids.php +++ b/Classes/Operation/Extension/PageSpeedInsights/GetDegradedPageUids.php @@ -31,7 +31,7 @@ class GetDegradedPageUids implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult The extension version */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { if (!ExtensionManagementUtility::isLoaded('pagespeedinsights')) { return new OperationResult(false, ''); diff --git a/Classes/Operation/GetApplicationContext.php b/Classes/Operation/GetApplicationContext.php index 7aa3401..3a883d1 100644 --- a/Classes/Operation/GetApplicationContext.php +++ b/Classes/Operation/GetApplicationContext.php @@ -21,7 +21,7 @@ class GetApplicationContext implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult the current application context */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $applicationContext = Environment::getContext(); diff --git a/Classes/Operation/GetDatabaseAnalyzerSummary.php b/Classes/Operation/GetDatabaseAnalyzerSummary.php index af52c46..a8ff790 100644 --- a/Classes/Operation/GetDatabaseAnalyzerSummary.php +++ b/Classes/Operation/GetDatabaseAnalyzerSummary.php @@ -27,7 +27,7 @@ class GetDatabaseAnalyzerSummary implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult the current application context */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { try { $values = []; diff --git a/Classes/Operation/GetDatabaseVersion.php b/Classes/Operation/GetDatabaseVersion.php index 127e242..a7f9f7d 100644 --- a/Classes/Operation/GetDatabaseVersion.php +++ b/Classes/Operation/GetDatabaseVersion.php @@ -25,7 +25,7 @@ class GetDatabaseVersion implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult the current database version */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $db = []; foreach (GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionNames() as $connectionName) { diff --git a/Classes/Operation/GetDiskSpace.php b/Classes/Operation/GetDiskSpace.php index 30164e8..6f20b09 100644 --- a/Classes/Operation/GetDiskSpace.php +++ b/Classes/Operation/GetDiskSpace.php @@ -27,7 +27,7 @@ class GetDiskSpace implements IOperation, SingletonInterface * @param array $parameter * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $path = !empty($parameter['path']) ? $parameter['path'] : '/'; diff --git a/Classes/Operation/GetExtensionList.php b/Classes/Operation/GetExtensionList.php index 31f14b9..b9c0eee 100644 --- a/Classes/Operation/GetExtensionList.php +++ b/Classes/Operation/GetExtensionList.php @@ -39,7 +39,7 @@ class GetExtensionList implements IOperation, SingletonInterface * @param array $parameter Array of extension locations as string (system, global, local) * @return OperationResult The extension list */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $locations = explode(',', $parameter['scopes']); if (is_array($locations) && count($locations) > 0) { diff --git a/Classes/Operation/GetExtensionVersion.php b/Classes/Operation/GetExtensionVersion.php index 6e82b30..a617e0b 100644 --- a/Classes/Operation/GetExtensionVersion.php +++ b/Classes/Operation/GetExtensionVersion.php @@ -29,7 +29,7 @@ class GetExtensionVersion implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult The extension version */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { if (!isset($parameter['extensionKey']) || $parameter['extensionKey'] === '') { throw new InvalidArgumentException('no extensionKey set'); diff --git a/Classes/Operation/GetFeatureValue.php b/Classes/Operation/GetFeatureValue.php index d6c838d..e035125 100644 --- a/Classes/Operation/GetFeatureValue.php +++ b/Classes/Operation/GetFeatureValue.php @@ -36,7 +36,7 @@ class GetFeatureValue implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { if (!isset($parameter['feature']) || $parameter['feature'] === '') { throw new InvalidArgumentException('feature not set'); diff --git a/Classes/Operation/GetFileSpoolValue.php b/Classes/Operation/GetFileSpoolValue.php index db63e01..eb6e91a 100644 --- a/Classes/Operation/GetFileSpoolValue.php +++ b/Classes/Operation/GetFileSpoolValue.php @@ -30,7 +30,7 @@ class GetFileSpoolValue implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $value = $parameter['value'] ?? null; $filePath = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_spool_filepath'] ?? $GLOBALS['TYPO3_CONF_VARS']['MAIL']['spool_file_path'] ?? null; diff --git a/Classes/Operation/GetFilesystemChecksum.php b/Classes/Operation/GetFilesystemChecksum.php index bddf564..8afc9e7 100644 --- a/Classes/Operation/GetFilesystemChecksum.php +++ b/Classes/Operation/GetFilesystemChecksum.php @@ -32,7 +32,7 @@ class GetFilesystemChecksum implements IOperation, SingletonInterface * @param array $parameter Path to a file or folder * @return OperationResult The checksum of the given folder or file */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $path = $this->getPath($parameter['path']); $getSingleChecksums = $this->getPath($parameter['getSingleChecksums']); diff --git a/Classes/Operation/GetInsecureExtensionList.php b/Classes/Operation/GetInsecureExtensionList.php index 1de21bb..e5c32cc 100644 --- a/Classes/Operation/GetInsecureExtensionList.php +++ b/Classes/Operation/GetInsecureExtensionList.php @@ -30,7 +30,7 @@ class GetInsecureExtensionList implements IOperation, SingletonInterface * @param array $parameter Array of extension locations as string (loaded, existing) * @return OperationResult The extension list */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $scope = $parameter['scope'] ?? ''; diff --git a/Classes/Operation/GetLastExtensionListUpdate.php b/Classes/Operation/GetLastExtensionListUpdate.php index 6005ea2..2af9b66 100644 --- a/Classes/Operation/GetLastExtensionListUpdate.php +++ b/Classes/Operation/GetLastExtensionListUpdate.php @@ -25,7 +25,7 @@ class GetLastExtensionListUpdate implements IOperation, SingletonInterface { - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $typo3Version = GeneralUtility::makeInstance(Typo3Version::class); if (!ExtensionManagementUtility::isLoaded('scheduler')) { diff --git a/Classes/Operation/GetLastSchedulerRun.php b/Classes/Operation/GetLastSchedulerRun.php index 963aa68..f574349 100644 --- a/Classes/Operation/GetLastSchedulerRun.php +++ b/Classes/Operation/GetLastSchedulerRun.php @@ -19,7 +19,7 @@ class GetLastSchedulerRun implements IOperation, SingletonInterface { - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { /** @var Registry $registry */ $registry = GeneralUtility::makeInstance(Registry::class); diff --git a/Classes/Operation/GetLogResults.php b/Classes/Operation/GetLogResults.php index 267fe99..6785df3 100644 --- a/Classes/Operation/GetLogResults.php +++ b/Classes/Operation/GetLogResults.php @@ -50,7 +50,7 @@ class GetLogResults implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $filter = $parameter['filter']; diff --git a/Classes/Operation/GetOpCacheStatus.php b/Classes/Operation/GetOpCacheStatus.php index fe87ac2..b96659e 100644 --- a/Classes/Operation/GetOpCacheStatus.php +++ b/Classes/Operation/GetOpCacheStatus.php @@ -24,7 +24,7 @@ class GetOpCacheStatus implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult the current database version */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { /** @var OpcodeCacheService $opCacheService */ diff --git a/Classes/Operation/GetOutdatedExtensionList.php b/Classes/Operation/GetOutdatedExtensionList.php index 429de05..27a135d 100644 --- a/Classes/Operation/GetOutdatedExtensionList.php +++ b/Classes/Operation/GetOutdatedExtensionList.php @@ -29,7 +29,7 @@ class GetOutdatedExtensionList implements IOperation, SingletonInterface * @param array $parameter Array of extension locations as string (system, global, local) * @return OperationResult The extension list */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $scope = $parameter['scope'] ?? ''; diff --git a/Classes/Operation/GetPHPVersion.php b/Classes/Operation/GetPHPVersion.php index e06dd47..96053ac 100644 --- a/Classes/Operation/GetPHPVersion.php +++ b/Classes/Operation/GetPHPVersion.php @@ -26,7 +26,7 @@ class GetPHPVersion implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult the current PHP version */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { return new OperationResult(true, PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION); } diff --git a/Classes/Operation/GetProgramVersion.php b/Classes/Operation/GetProgramVersion.php index d19b3d7..13237b9 100644 --- a/Classes/Operation/GetProgramVersion.php +++ b/Classes/Operation/GetProgramVersion.php @@ -27,7 +27,7 @@ class GetProgramVersion implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult the current PHP version */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { if (!isset($parameter['program']) || $parameter['program'] === '') { diff --git a/Classes/Operation/GetRecord.php b/Classes/Operation/GetRecord.php index d7ec2fb..c6838d0 100644 --- a/Classes/Operation/GetRecord.php +++ b/Classes/Operation/GetRecord.php @@ -46,7 +46,7 @@ class GetRecord implements IOperation, SingletonInterface * @param array $parameter A table 'table', field name 'field' and the value 'value' to find the record * @return OperationResult The first found record as an array or FALSE if no record was found */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $table = $parameter['table']; $field = $parameter['field']; diff --git a/Classes/Operation/GetRecords.php b/Classes/Operation/GetRecords.php index 3198729..06e32bf 100644 --- a/Classes/Operation/GetRecords.php +++ b/Classes/Operation/GetRecords.php @@ -97,7 +97,7 @@ class GetRecords implements IOperation, SingletonInterface * @return OperationResult A set of records as an array or FALSE if no record was found * @example ../services/class.FindBlacklistedBePasswordTestService.php This class tests if there are duplicate passwords, besides checking for the presence of blacklisted passwords. */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $table = $parameter['table']; $field = $parameter['field']; diff --git a/Classes/Operation/GetTYPO3Version.php b/Classes/Operation/GetTYPO3Version.php index af44808..0b1cac1 100644 --- a/Classes/Operation/GetTYPO3Version.php +++ b/Classes/Operation/GetTYPO3Version.php @@ -25,7 +25,7 @@ class GetTYPO3Version implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult the current PHP version */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $typo3Version = GeneralUtility::makeInstance(Typo3Version::class); diff --git a/Classes/Operation/GetTotalLogFilesSize.php b/Classes/Operation/GetTotalLogFilesSize.php index 4ab1442..20b19c4 100644 --- a/Classes/Operation/GetTotalLogFilesSize.php +++ b/Classes/Operation/GetTotalLogFilesSize.php @@ -28,7 +28,7 @@ class GetTotalLogFilesSize implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $totalSize = 0; $files = GeneralUtility::getFilesInDir(Environment::getVarPath() . '/log/', 'log'); diff --git a/Classes/Operation/GetZabbixLogFileSize.php b/Classes/Operation/GetZabbixLogFileSize.php index d8f53d0..59bec3c 100644 --- a/Classes/Operation/GetZabbixLogFileSize.php +++ b/Classes/Operation/GetZabbixLogFileSize.php @@ -31,7 +31,7 @@ class GetZabbixLogFileSize implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $totalSize = 0; diff --git a/Classes/Operation/HasDeprecationLogEnabled.php b/Classes/Operation/HasDeprecationLogEnabled.php index 307363c..1e18d79 100644 --- a/Classes/Operation/HasDeprecationLogEnabled.php +++ b/Classes/Operation/HasDeprecationLogEnabled.php @@ -36,7 +36,7 @@ class HasDeprecationLogEnabled implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $errorHandlerErrors = $GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors']; diff --git a/Classes/Operation/HasExtensionUpdate.php b/Classes/Operation/HasExtensionUpdate.php index b2da80e..77380ef 100644 --- a/Classes/Operation/HasExtensionUpdate.php +++ b/Classes/Operation/HasExtensionUpdate.php @@ -28,7 +28,7 @@ class HasExtensionUpdate implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { if (!isset($parameter['extensionKey']) || $parameter['extensionKey'] === '') { diff --git a/Classes/Operation/HasFailedSchedulerTask.php b/Classes/Operation/HasFailedSchedulerTask.php index 7ca8102..53bdbd3 100644 --- a/Classes/Operation/HasFailedSchedulerTask.php +++ b/Classes/Operation/HasFailedSchedulerTask.php @@ -29,7 +29,7 @@ class HasFailedSchedulerTask implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_scheduler_task'); $queryBuilder diff --git a/Classes/Operation/HasForbiddenUsers.php b/Classes/Operation/HasForbiddenUsers.php index 0395e3b..791d231 100644 --- a/Classes/Operation/HasForbiddenUsers.php +++ b/Classes/Operation/HasForbiddenUsers.php @@ -30,7 +30,7 @@ class HasForbiddenUsers implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { if (!isset($parameter['usernames'])) { diff --git a/Classes/Operation/HasIPTCPreservation.php b/Classes/Operation/HasIPTCPreservation.php index 961e299..f65e4e3 100644 --- a/Classes/Operation/HasIPTCPreservation.php +++ b/Classes/Operation/HasIPTCPreservation.php @@ -30,7 +30,7 @@ class HasIPTCPreservation implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { return new OperationResult(true, strpos($GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_stripColorProfileCommand'] ?? '','!iptc') !== false); } diff --git a/Classes/Operation/HasMissingDefaultMailSettings.php b/Classes/Operation/HasMissingDefaultMailSettings.php index 07ea678..7f49df9 100644 --- a/Classes/Operation/HasMissingDefaultMailSettings.php +++ b/Classes/Operation/HasMissingDefaultMailSettings.php @@ -28,7 +28,7 @@ class HasMissingDefaultMailSettings implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { if (empty($GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'])) { diff --git a/Classes/Operation/HasOutdatedVersion.php b/Classes/Operation/HasOutdatedVersion.php index c8b2074..556467a 100644 --- a/Classes/Operation/HasOutdatedVersion.php +++ b/Classes/Operation/HasOutdatedVersion.php @@ -29,7 +29,7 @@ class HasOutdatedVersion implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { /** @var CoreVersionService $coreVersionService */ diff --git a/Classes/Operation/HasRemainingUpdates.php b/Classes/Operation/HasRemainingUpdates.php index 26cf20e..b839e96 100644 --- a/Classes/Operation/HasRemainingUpdates.php +++ b/Classes/Operation/HasRemainingUpdates.php @@ -27,7 +27,7 @@ class HasRemainingUpdates implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { $upgradeWizardsService = GeneralUtility::makeInstance(UpgradeWizardsService::class); diff --git a/Classes/Operation/HasSecurityUpdate.php b/Classes/Operation/HasSecurityUpdate.php index 1d6846d..c6318c0 100644 --- a/Classes/Operation/HasSecurityUpdate.php +++ b/Classes/Operation/HasSecurityUpdate.php @@ -29,7 +29,7 @@ class HasSecurityUpdate implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { /** @var CoreVersionService $coreVersionService */ $coreVersionService = GeneralUtility::makeInstance(CoreVersionService::class); diff --git a/Classes/Operation/HasStrictSyntaxEnabled.php b/Classes/Operation/HasStrictSyntaxEnabled.php index 7fd70f2..cfb7400 100644 --- a/Classes/Operation/HasStrictSyntaxEnabled.php +++ b/Classes/Operation/HasStrictSyntaxEnabled.php @@ -30,7 +30,7 @@ class HasStrictSyntaxEnabled implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { return new OperationResult(true, GeneralUtility::makeInstance(Features::class)->isFeatureEnabled('TypoScript.strictSyntax')); diff --git a/Classes/Operation/HasUpdate.php b/Classes/Operation/HasUpdate.php index cd6829a..3bb2c6e 100644 --- a/Classes/Operation/HasUpdate.php +++ b/Classes/Operation/HasUpdate.php @@ -29,7 +29,7 @@ class HasUpdate implements IOperation, SingletonInterface * @param array $parameter None * @return OperationResult */ - public function execute($parameter = []) + public function execute(array $parameter = []): OperationResult { /** @var CoreVersionService $coreVersionService */ diff --git a/Classes/Operation/IOperation.php b/Classes/Operation/IOperation.php index c27b065..4a7d685 100644 --- a/Classes/Operation/IOperation.php +++ b/Classes/Operation/IOperation.php @@ -18,5 +18,5 @@ interface IOperation * @param array $parameter Parameters for the operation * @return OperationResult The operation result */ - public function execute($parameter = []); + public function execute(array $parameter = []): OperationResult; }