diff options
Diffstat (limited to 'core/Command')
87 files changed, 240 insertions, 714 deletions
diff --git a/core/Command/App/Disable.php b/core/Command/App/Disable.php index 76b0201681c..05d35053b13 100644 --- a/core/Command/App/Disable.php +++ b/core/Command/App/Disable.php @@ -33,16 +33,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Disable extends Command implements CompletionAwareInterface { + protected IAppManager $appManager; + protected int $exitCode = 0; - /** @var IAppManager */ - protected $appManager; - - /** @var int */ - protected $exitCode = 0; - - /** - * @param IAppManager $appManager - */ public function __construct(IAppManager $appManager) { parent::__construct(); $this->appManager = $appManager; diff --git a/core/Command/App/Enable.php b/core/Command/App/Enable.php index 402d1b98acb..c7a071e27b5 100644 --- a/core/Command/App/Enable.php +++ b/core/Command/App/Enable.php @@ -39,20 +39,10 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Enable extends Command implements CompletionAwareInterface { + protected IAppManager $appManager; + protected IGroupManager $groupManager; + protected int $exitCode = 0; - /** @var IAppManager */ - protected $appManager; - - /** @var IGroupManager */ - protected $groupManager; - - /** @var int */ - protected $exitCode = 0; - - /** - * @param IAppManager $appManager - * @param IGroupManager $groupManager - */ public function __construct(IAppManager $appManager, IGroupManager $groupManager) { parent::__construct(); $this->appManager = $appManager; diff --git a/core/Command/App/ListApps.php b/core/Command/App/ListApps.php index 85ec1d3c0d1..6f8858c8858 100644 --- a/core/Command/App/ListApps.php +++ b/core/Command/App/ListApps.php @@ -33,13 +33,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class ListApps extends Base { + protected IAppManager $manager; - /** @var IAppManager */ - protected $manager; - - /** - * @param IAppManager $manager - */ public function __construct(IAppManager $manager) { parent::__construct(); $this->manager = $manager; diff --git a/core/Command/App/Remove.php b/core/Command/App/Remove.php index 101c8235187..2aa453132e4 100644 --- a/core/Command/App/Remove.php +++ b/core/Command/App/Remove.php @@ -28,7 +28,7 @@ namespace OC\Core\Command\App; use OC\Installer; use OCP\App\IAppManager; -use OCP\ILogger; +use Psr\Log\LoggerInterface; use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface; use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Symfony\Component\Console\Command\Command; @@ -39,20 +39,11 @@ use Symfony\Component\Console\Output\OutputInterface; use Throwable; class Remove extends Command implements CompletionAwareInterface { + protected IAppManager $manager; + private Installer $installer; + private LoggerInterface $logger; - /** @var IAppManager */ - protected $manager; - /** @var Installer */ - private $installer; - /** @var ILogger */ - private $logger; - - /** - * @param IAppManager $manager - * @param Installer $installer - * @param ILogger $logger - */ - public function __construct(IAppManager $manager, Installer $installer, ILogger $logger) { + public function __construct(IAppManager $manager, Installer $installer, LoggerInterface $logger) { parent::__construct(); $this->manager = $manager; $this->installer = $installer; @@ -100,9 +91,9 @@ class Remove extends Command implements CompletionAwareInterface { $output->writeln($appId . ' disabled'); } catch (Throwable $e) { $output->writeln('<error>Error: ' . $e->getMessage() . '</error>'); - $this->logger->logException($e, [ + $this->logger->error($e->getMessage(), [ 'app' => 'CLI', - 'level' => ILogger::ERROR + 'exception' => $e, ]); return 1; } @@ -113,9 +104,9 @@ class Remove extends Command implements CompletionAwareInterface { $result = $this->installer->removeApp($appId); } catch (Throwable $e) { $output->writeln('<error>Error: ' . $e->getMessage() . '</error>'); - $this->logger->logException($e, [ + $this->logger->error($e->getMessage(), [ 'app' => 'CLI', - 'level' => ILogger::ERROR + 'exception' => $e, ]); return 1; } diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php index 2e72ffa5b90..6a6d43c28e5 100644 --- a/core/Command/App/Update.php +++ b/core/Command/App/Update.php @@ -29,7 +29,7 @@ namespace OC\Core\Command\App; use OC\Installer; use OCP\App\IAppManager; -use OCP\ILogger; +use Psr\Log\LoggerInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -37,19 +37,11 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Update extends Command { + protected IAppManager $manager; + private Installer $installer; + private LoggerInterface $logger; - /** @var IAppManager */ - protected $manager; - /** @var Installer */ - private $installer; - /** @var ILogger */ - private $logger; - - /** - * @param IAppManager $manager - * @param Installer $installer - */ - public function __construct(IAppManager $manager, Installer $installer, ILogger $logger) { + public function __construct(IAppManager $manager, Installer $installer, LoggerInterface $logger) { parent::__construct(); $this->manager = $manager; $this->installer = $installer; @@ -114,7 +106,10 @@ class Update extends Command { try { $result = $this->installer->updateAppstoreApp($appId, $input->getOption('allow-unstable')); } catch (\Exception $e) { - $this->logger->logException($e, ['message' => 'Failure during update of app "' . $appId . '"','app' => 'app:update']); + $this->logger->error('Failure during update of app "' . $appId . '"', [ + 'app' => 'app:update', + 'exception' => $e, + ]); $output->writeln('Error: ' . $e->getMessage()); $return = 1; } diff --git a/core/Command/Background/Base.php b/core/Command/Background/Base.php index b80fd751177..dca7b58a5fc 100644 --- a/core/Command/Background/Base.php +++ b/core/Command/Background/Base.php @@ -38,15 +38,8 @@ use Symfony\Component\Console\Output\OutputInterface; */ abstract class Base extends Command { abstract protected function getMode(); + protected IConfig $config; - /** - * @var \OCP\IConfig - */ - protected $config; - - /** - * @param \OCP\IConfig $config - */ public function __construct(IConfig $config) { parent::__construct(); $this->config = $config; diff --git a/core/Command/Background/Job.php b/core/Command/Background/Job.php index fdac7ed5f27..742bdd4329e 100644 --- a/core/Command/Background/Job.php +++ b/core/Command/Background/Job.php @@ -35,10 +35,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Job extends Command { - /** @var IJobList */ - protected $jobList; - /** @var ILogger */ - protected $logger; + protected IJobList $jobList; + protected ILogger $logger; public function __construct(IJobList $jobList, ILogger $logger) { diff --git a/core/Command/Base.php b/core/Command/Base.php index 029942c0673..d228e362447 100644 --- a/core/Command/Base.php +++ b/core/Command/Base.php @@ -38,13 +38,9 @@ class Base extends Command implements CompletionAwareInterface { public const OUTPUT_FORMAT_JSON = 'json'; public const OUTPUT_FORMAT_JSON_PRETTY = 'json_pretty'; - protected $defaultOutputFormat = self::OUTPUT_FORMAT_PLAIN; - - /** @var boolean */ - private $php_pcntl_signal = false; - - /** @var boolean */ - private $interrupted = false; + protected string $defaultOutputFormat = self::OUTPUT_FORMAT_PLAIN; + private bool $php_pcntl_signal = false; + private bool $interrupted = false; protected function configure() { $this @@ -58,13 +54,7 @@ class Base extends Command implements CompletionAwareInterface { ; } - /** - * @param InputInterface $input - * @param OutputInterface $output - * @param array $items - * @param string $prefix - */ - protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, $items, $prefix = ' - ') { + protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, array $items, string $prefix = ' - ') { switch ($input->getOption('output')) { case self::OUTPUT_FORMAT_JSON: $output->writeln(json_encode($items)); @@ -95,8 +85,6 @@ class Base extends Command implements CompletionAwareInterface { } /** - * @param InputInterface $input - * @param OutputInterface $output * @param mixed $item */ protected function writeMixedInOutputFormat(InputInterface $input, OutputInterface $output, $item) { @@ -118,7 +106,7 @@ class Base extends Command implements CompletionAwareInterface { } } - protected function valueToString($value, $returnNull = true) { + protected function valueToString($value, bool $returnNull = true): ?string { if ($value === false) { return 'false'; } elseif ($value === true) { diff --git a/core/Command/Broadcast/Test.php b/core/Command/Broadcast/Test.php index 86cd30e4b4c..7a67c983f79 100644 --- a/core/Command/Broadcast/Test.php +++ b/core/Command/Broadcast/Test.php @@ -34,9 +34,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Test extends Command { - - /** @var IEventDispatcher */ - private $eventDispatcher; + private IEventDispatcher $eventDispatcher; public function __construct(IEventDispatcher $eventDispatcher) { parent::__construct(); diff --git a/core/Command/Check.php b/core/Command/Check.php index 10c6c6cf522..18c45323f37 100644 --- a/core/Command/Check.php +++ b/core/Command/Check.php @@ -29,10 +29,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Check extends Base { - /** - * @var SystemConfig - */ - private $config; + private SystemConfig $config; public function __construct(SystemConfig $config) { parent::__construct(); diff --git a/core/Command/Config/App/Base.php b/core/Command/Config/App/Base.php index ec2207c6de5..b40f7c9e48d 100644 --- a/core/Command/Config/App/Base.php +++ b/core/Command/Config/App/Base.php @@ -26,9 +26,7 @@ use OCP\IConfig; use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; abstract class Base extends \OC\Core\Command\Base { - - /** * @var IConfig */ - protected $config; + protected IConfig $config; /** * @param string $argumentName diff --git a/core/Command/Config/App/DeleteConfig.php b/core/Command/Config/App/DeleteConfig.php index 4a2a4eb6b75..0da1e965bd0 100644 --- a/core/Command/Config/App/DeleteConfig.php +++ b/core/Command/Config/App/DeleteConfig.php @@ -28,8 +28,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class DeleteConfig extends Base { - /** * @var IConfig */ - protected $config; + protected IConfig $config; /** * @param IConfig $config diff --git a/core/Command/Config/App/GetConfig.php b/core/Command/Config/App/GetConfig.php index e0beb4ee84e..7fdff2be732 100644 --- a/core/Command/Config/App/GetConfig.php +++ b/core/Command/Config/App/GetConfig.php @@ -28,12 +28,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class GetConfig extends Base { - /** * @var IConfig */ - protected $config; + protected IConfig $config; - /** - * @param IConfig $config - */ public function __construct(IConfig $config) { parent::__construct(); $this->config = $config; diff --git a/core/Command/Config/App/SetConfig.php b/core/Command/Config/App/SetConfig.php index 162f5f5f819..89a5f6ba5d1 100644 --- a/core/Command/Config/App/SetConfig.php +++ b/core/Command/Config/App/SetConfig.php @@ -28,12 +28,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class SetConfig extends Base { - /** * @var IConfig */ - protected $config; + protected IConfig $config; - /** - * @param IConfig $config - */ public function __construct(IConfig $config) { parent::__construct(); $this->config = $config; diff --git a/core/Command/Config/Import.php b/core/Command/Config/Import.php index e55f127d94e..a823c8133b9 100644 --- a/core/Command/Config/Import.php +++ b/core/Command/Config/Import.php @@ -34,14 +34,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Import extends Command implements CompletionAwareInterface { - protected $validRootKeys = ['system', 'apps']; + protected array $validRootKeys = ['system', 'apps']; + protected IConfig $config; - /** @var IConfig */ - protected $config; - - /** - * @param IConfig $config - */ public function __construct(IConfig $config) { parent::__construct(); $this->config = $config; diff --git a/core/Command/Config/ListConfigs.php b/core/Command/Config/ListConfigs.php index b19a09cec97..a0fa9a84ea8 100644 --- a/core/Command/Config/ListConfigs.php +++ b/core/Command/Config/ListConfigs.php @@ -32,18 +32,10 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class ListConfigs extends Base { - protected $defaultOutputFormat = self::OUTPUT_FORMAT_JSON_PRETTY; + protected string $defaultOutputFormat = self::OUTPUT_FORMAT_JSON_PRETTY; + protected SystemConfig $systemConfig; + protected IAppConfig $appConfig; - /** * @var SystemConfig */ - protected $systemConfig; - - /** @var IAppConfig */ - protected $appConfig; - - /** - * @param SystemConfig $systemConfig - * @param IAppConfig $appConfig - */ public function __construct(SystemConfig $systemConfig, IAppConfig $appConfig) { parent::__construct(); $this->systemConfig = $systemConfig; diff --git a/core/Command/Config/System/Base.php b/core/Command/Config/System/Base.php index 0f43c21c977..18bc9cb7ca0 100644 --- a/core/Command/Config/System/Base.php +++ b/core/Command/Config/System/Base.php @@ -26,9 +26,12 @@ use OC\SystemConfig; use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; abstract class Base extends \OC\Core\Command\Base { + protected SystemConfig $systemConfig; - /** @var SystemConfig */ - protected $systemConfig; + public function __construct(SystemConfig $systemConfig) { + parent::__construct(); + $this->systemConfig = $systemConfig; + } /** * @param string $argumentName diff --git a/core/Command/Config/System/DeleteConfig.php b/core/Command/Config/System/DeleteConfig.php index 8ce227e607a..f4d49ba8f51 100644 --- a/core/Command/Config/System/DeleteConfig.php +++ b/core/Command/Config/System/DeleteConfig.php @@ -30,15 +30,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class DeleteConfig extends Base { - /** * @var SystemConfig */ - protected $systemConfig; - - /** - * @param SystemConfig $systemConfig - */ public function __construct(SystemConfig $systemConfig) { - parent::__construct(); - $this->systemConfig = $systemConfig; + parent::__construct($systemConfig); } protected function configure() { diff --git a/core/Command/Config/System/GetConfig.php b/core/Command/Config/System/GetConfig.php index 265fc70900f..01bbf82d5d1 100644 --- a/core/Command/Config/System/GetConfig.php +++ b/core/Command/Config/System/GetConfig.php @@ -29,15 +29,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class GetConfig extends Base { - /** * @var SystemConfig */ - protected $systemConfig; - - /** - * @param SystemConfig $systemConfig - */ public function __construct(SystemConfig $systemConfig) { - parent::__construct(); - $this->systemConfig = $systemConfig; + parent::__construct($systemConfig); } protected function configure() { diff --git a/core/Command/Config/System/SetConfig.php b/core/Command/Config/System/SetConfig.php index 4b6ae73004d..01a1999bcf9 100644 --- a/core/Command/Config/System/SetConfig.php +++ b/core/Command/Config/System/SetConfig.php @@ -32,15 +32,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class SetConfig extends Base { - /** * @var SystemConfig */ - protected $systemConfig; - - /** - * @param SystemConfig $systemConfig - */ public function __construct(SystemConfig $systemConfig) { - parent::__construct(); - $this->systemConfig = $systemConfig; + parent::__construct($systemConfig); } protected function configure() { diff --git a/core/Command/Db/AddMissingColumns.php b/core/Command/Db/AddMissingColumns.php index 1e338e151df..acc05c3b7ff 100644 --- a/core/Command/Db/AddMissingColumns.php +++ b/core/Command/Db/AddMissingColumns.php @@ -45,12 +45,8 @@ use Symfony\Component\EventDispatcher\GenericEvent; * @package OC\Core\Command\Db */ class AddMissingColumns extends Command { - - /** @var Connection */ - private $connection; - - /** @var EventDispatcherInterface */ - private $dispatcher; + private Connection $connection; + private EventDispatcherInterface $dispatcher; public function __construct(Connection $connection, EventDispatcherInterface $dispatcher) { parent::__construct(); diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 8394e75e845..957c5251454 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -53,12 +53,8 @@ use Symfony\Component\EventDispatcher\GenericEvent; * @package OC\Core\Command\Db */ class AddMissingIndices extends Command { - - /** @var Connection */ - private $connection; - - /** @var EventDispatcherInterface */ - private $dispatcher; + private Connection $connection; + private EventDispatcherInterface $dispatcher; public function __construct(Connection $connection, EventDispatcherInterface $dispatcher) { parent::__construct(); diff --git a/core/Command/Db/AddMissingPrimaryKeys.php b/core/Command/Db/AddMissingPrimaryKeys.php index cbb99a69251..8262cf37e77 100644 --- a/core/Command/Db/AddMissingPrimaryKeys.php +++ b/core/Command/Db/AddMissingPrimaryKeys.php @@ -45,12 +45,8 @@ use Symfony\Component\EventDispatcher\GenericEvent; * @package OC\Core\Command\Db */ class AddMissingPrimaryKeys extends Command { - - /** @var Connection */ - private $connection; - - /** @var EventDispatcherInterface */ - private $dispatcher; + private Connection $connection; + private EventDispatcherInterface $dispatcher; public function __construct(Connection $connection, EventDispatcherInterface $dispatcher) { parent::__construct(); diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php index 34b717025a0..f12ae15f0b3 100644 --- a/core/Command/Db/ConvertFilecacheBigInt.php +++ b/core/Command/Db/ConvertFilecacheBigInt.php @@ -42,13 +42,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; class ConvertFilecacheBigInt extends Command { + private Connection $connection; - /** @var Connection */ - private $connection; - - /** - * @param Connection $connection - */ public function __construct(Connection $connection) { $this->connection = $connection; parent::__construct(); diff --git a/core/Command/Db/ConvertMysqlToMB4.php b/core/Command/Db/ConvertMysqlToMB4.php index 28f7ae6b2fa..19a9532d910 100644 --- a/core/Command/Db/ConvertMysqlToMB4.php +++ b/core/Command/Db/ConvertMysqlToMB4.php @@ -37,15 +37,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ConvertMysqlToMB4 extends Command { - /** @var IConfig */ - private $config; - - /** @var IDBConnection */ - private $connection; - - /** @var IURLGenerator */ - private $urlGenerator; - + private IConfig $config; + private IDBConnection $connection; + private IURLGenerator $urlGenerator; private LoggerInterface $logger; public function __construct( diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index 754cbd08812..f7638e3024f 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -56,23 +56,10 @@ use function preg_match; use function preg_quote; class ConvertType extends Command implements CompletionAwareInterface { - /** - * @var \OCP\IConfig - */ - protected $config; - - /** - * @var \OC\DB\ConnectionFactory - */ - protected $connectionFactory; - - /** @var array */ - protected $columnTypes; + protected IConfig $config; + protected ConnectionFactory $connectionFactory; + protected array $columnTypes; - /** - * @param \OCP\IConfig $config - * @param \OC\DB\ConnectionFactory $connectionFactory - */ public function __construct(IConfig $config, ConnectionFactory $connectionFactory) { $this->config = $config; $this->connectionFactory = $connectionFactory; diff --git a/core/Command/Db/Migrations/ExecuteCommand.php b/core/Command/Db/Migrations/ExecuteCommand.php index 6f4559ee7b4..e87e133fa31 100644 --- a/core/Command/Db/Migrations/ExecuteCommand.php +++ b/core/Command/Db/Migrations/ExecuteCommand.php @@ -35,19 +35,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ExecuteCommand extends Command implements CompletionAwareInterface { + private Connection $connection; + private IConfig $config; - /** @var Connection */ - private $connection; - - /** @var IConfig */ - private $config; - - /** - * ExecuteCommand constructor. - * - * @param Connection $connection - * @param IConfig $config - */ public function __construct(Connection $connection, IConfig $config) { $this->connection = $connection; $this->config = $config; diff --git a/core/Command/Db/Migrations/GenerateCommand.php b/core/Command/Db/Migrations/GenerateCommand.php index a4e9bd63c89..6c11c7705d2 100644 --- a/core/Command/Db/Migrations/GenerateCommand.php +++ b/core/Command/Db/Migrations/GenerateCommand.php @@ -106,16 +106,9 @@ class {{classname}} extends SimpleMigrationStep { } '; - /** @var Connection */ - protected $connection; + protected Connection $connection; + protected IAppManager $appManager; - /** @var IAppManager */ - protected $appManager; - - /** - * @param Connection $connection - * @param IAppManager $appManager - */ public function __construct(Connection $connection, IAppManager $appManager) { $this->connection = $connection; $this->appManager = $appManager; diff --git a/core/Command/Db/Migrations/MigrateCommand.php b/core/Command/Db/Migrations/MigrateCommand.php index 26f350cdae6..f0f35716997 100644 --- a/core/Command/Db/Migrations/MigrateCommand.php +++ b/core/Command/Db/Migrations/MigrateCommand.php @@ -33,13 +33,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class MigrateCommand extends Command implements CompletionAwareInterface { + private Connection $connection; - /** @var Connection */ - private $connection; - - /** - * @param Connection $connection - */ public function __construct(Connection $connection) { $this->connection = $connection; parent::__construct(); diff --git a/core/Command/Db/Migrations/StatusCommand.php b/core/Command/Db/Migrations/StatusCommand.php index fabaabe0a3e..725ee075215 100644 --- a/core/Command/Db/Migrations/StatusCommand.php +++ b/core/Command/Db/Migrations/StatusCommand.php @@ -34,9 +34,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class StatusCommand extends Command implements CompletionAwareInterface { - - /** @var Connection */ - private $connection; + private Connection $connection; public function __construct(Connection $connection) { $this->connection = $connection; diff --git a/core/Command/Encryption/ChangeKeyStorageRoot.php b/core/Command/Encryption/ChangeKeyStorageRoot.php index 633ae2c4a7a..6ae59421a69 100644 --- a/core/Command/Encryption/ChangeKeyStorageRoot.php +++ b/core/Command/Encryption/ChangeKeyStorageRoot.php @@ -40,29 +40,12 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; class ChangeKeyStorageRoot extends Command { + protected View $rootView; + protected IUserManager $userManager; + protected IConfig $config; + protected Util $util; + protected QuestionHelper $questionHelper; - /** @var View */ - protected $rootView; - - /** @var IUserManager */ - protected $userManager; - - /** @var IConfig */ - protected $config; - - /** @var Util */ - protected $util; - - /** @var QuestionHelper */ - protected $questionHelper; - - /** - * @param View $view - * @param IUserManager $userManager - * @param IConfig $config - * @param Util $util - * @param QuestionHelper $questionHelper - */ public function __construct(View $view, IUserManager $userManager, IConfig $config, Util $util, QuestionHelper $questionHelper) { parent::__construct(); $this->rootView = $view; diff --git a/core/Command/Encryption/DecryptAll.php b/core/Command/Encryption/DecryptAll.php index 7382c254723..ce17f787abd 100644 --- a/core/Command/Encryption/DecryptAll.php +++ b/core/Command/Encryption/DecryptAll.php @@ -41,35 +41,14 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; class DecryptAll extends Command { + protected IManager $encryptionManager; + protected IAppManager $appManager; + protected IConfig $config; + protected QuestionHelper $questionHelper; + protected bool $wasTrashbinEnabled; + protected bool $wasMaintenanceModeEnabled; + protected \OC\Encryption\DecryptAll $decryptAll; - /** @var IManager */ - protected $encryptionManager; - - /** @var IAppManager */ - protected $appManager; - - /** @var IConfig */ - protected $config; - - /** @var QuestionHelper */ - protected $questionHelper; - - /** @var bool */ - protected $wasTrashbinEnabled; - - /** @var bool */ - protected $wasMaintenanceModeEnabled; - - /** @var \OC\Encryption\DecryptAll */ - protected $decryptAll; - - /** - * @param IManager $encryptionManager - * @param IAppManager $appManager - * @param IConfig $config - * @param \OC\Encryption\DecryptAll $decryptAll - * @param QuestionHelper $questionHelper - */ public function __construct( IManager $encryptionManager, IAppManager $appManager, @@ -89,7 +68,7 @@ class DecryptAll extends Command { /** * Set maintenance mode and disable the trashbin app */ - protected function forceMaintenanceAndTrashbin() { + protected function forceMaintenanceAndTrashbin(): void { $this->wasTrashbinEnabled = $this->appManager->isEnabledForUser('files_trashbin'); $this->wasMaintenanceModeEnabled = $this->config->getSystemValueBool('maintenance'); $this->config->setSystemValue('maintenance', true); @@ -99,7 +78,7 @@ class DecryptAll extends Command { /** * Reset the maintenance mode and re-enable the trashbin app */ - protected function resetMaintenanceAndTrashbin() { + protected function resetMaintenanceAndTrashbin(): void { $this->config->setSystemValue('maintenance', $this->wasMaintenanceModeEnabled); if ($this->wasTrashbinEnabled) { $this->appManager->enableApp('files_trashbin'); @@ -181,13 +160,12 @@ class DecryptAll extends Command { } $this->resetMaintenanceAndTrashbin(); return 0; - } else { - $output->write('Enable server side encryption... '); - $this->config->setAppValue('core', 'encryption_enabled', 'yes'); - $output->writeln('done.'); - $output->writeln('aborted'); - return 1; } + $output->write('Enable server side encryption... '); + $this->config->setAppValue('core', 'encryption_enabled', 'yes'); + $output->writeln('done.'); + $output->writeln('aborted'); + return 1; } catch (\Exception $e) { // enable server side encryption again if something went wrong $this->config->setAppValue('core', 'encryption_enabled', 'yes'); diff --git a/core/Command/Encryption/Disable.php b/core/Command/Encryption/Disable.php index fca810b2ab2..446601a1b4f 100644 --- a/core/Command/Encryption/Disable.php +++ b/core/Command/Encryption/Disable.php @@ -27,12 +27,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Disable extends Command { - /** @var IConfig */ - protected $config; + protected IConfig $config; - /** - * @param IConfig $config - */ public function __construct(IConfig $config) { parent::__construct(); $this->config = $config; diff --git a/core/Command/Encryption/Enable.php b/core/Command/Encryption/Enable.php index 99c60bc9b5f..9d680144e60 100644 --- a/core/Command/Encryption/Enable.php +++ b/core/Command/Encryption/Enable.php @@ -29,16 +29,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Enable extends Command { - /** @var IConfig */ - protected $config; + protected IConfig $config; + protected IManager $encryptionManager; - /** @var IManager */ - protected $encryptionManager; - - /** - * @param IConfig $config - * @param IManager $encryptionManager - */ public function __construct(IConfig $config, IManager $encryptionManager) { parent::__construct(); diff --git a/core/Command/Encryption/EncryptAll.php b/core/Command/Encryption/EncryptAll.php index 54e33221f4a..11e33ae9e2e 100644 --- a/core/Command/Encryption/EncryptAll.php +++ b/core/Command/Encryption/EncryptAll.php @@ -36,31 +36,13 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; class EncryptAll extends Command { + protected IManager $encryptionManager; + protected IAppManager $appManager; + protected IConfig $config; + protected QuestionHelper $questionHelper; + protected bool $wasTrashbinEnabled = false; + protected bool $wasMaintenanceModeEnabled; - /** @var IManager */ - protected $encryptionManager; - - /** @var IAppManager */ - protected $appManager; - - /** @var IConfig */ - protected $config; - - /** @var QuestionHelper */ - protected $questionHelper; - - /** @var bool */ - protected $wasTrashbinEnabled; - - /** @var bool */ - protected $wasMaintenanceModeEnabled; - - /** - * @param IManager $encryptionManager - * @param IAppManager $appManager - * @param IConfig $config - * @param QuestionHelper $questionHelper - */ public function __construct( IManager $encryptionManager, IAppManager $appManager, @@ -77,8 +59,8 @@ class EncryptAll extends Command { /** * Set maintenance mode and disable the trashbin app */ - protected function forceMaintenanceAndTrashbin() { - $this->wasTrashbinEnabled = $this->appManager->isEnabledForUser('files_trashbin'); + protected function forceMaintenanceAndTrashbin(): void { + $this->wasTrashbinEnabled = (bool)$this->appManager->isEnabledForUser('files_trashbin'); $this->wasMaintenanceModeEnabled = $this->config->getSystemValueBool('maintenance'); $this->config->setSystemValue('maintenance', true); $this->appManager->disableApp('files_trashbin'); @@ -87,7 +69,7 @@ class EncryptAll extends Command { /** * Reset the maintenance mode and re-enable the trashbin app */ - protected function resetMaintenanceAndTrashbin() { + protected function resetMaintenanceAndTrashbin(): void { $this->config->setSystemValue('maintenance', $this->wasMaintenanceModeEnabled); if ($this->wasTrashbinEnabled) { $this->appManager->enableApp('files_trashbin'); @@ -138,10 +120,9 @@ class EncryptAll extends Command { } $this->resetMaintenanceAndTrashbin(); - } else { - $output->writeln('aborted'); - return 1; + return 0; } - return 0; + $output->writeln('aborted'); + return 1; } } diff --git a/core/Command/Encryption/ListModules.php b/core/Command/Encryption/ListModules.php index 9105dff3f6d..88ad9875073 100644 --- a/core/Command/Encryption/ListModules.php +++ b/core/Command/Encryption/ListModules.php @@ -30,16 +30,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ListModules extends Base { - /** @var IManager */ - protected $encryptionManager; + protected IManager $encryptionManager; + protected IConfig $config; - /** @var IConfig */ - protected $config; - - /** - * @param IManager $encryptionManager - * @param IConfig $config - */ public function __construct( IManager $encryptionManager, IConfig $config diff --git a/core/Command/Encryption/MigrateKeyStorage.php b/core/Command/Encryption/MigrateKeyStorage.php index 43b725f6ad8..8d9c7910769 100644 --- a/core/Command/Encryption/MigrateKeyStorage.php +++ b/core/Command/Encryption/MigrateKeyStorage.php @@ -38,25 +38,12 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class MigrateKeyStorage extends Command { - - /** @var View */ - protected $rootView; - - /** @var IUserManager */ - protected $userManager; - - /** @var IConfig */ - protected $config; - - /** @var Util */ - protected $util; - - /** @var QuestionHelper */ - protected $questionHelper; - /** - * @var ICrypto - */ - private $crypto; + protected View $rootView; + protected IUserManager $userManager; + protected IConfig $config; + protected Util $util; + protected QuestionHelper $questionHelper; + private ICrypto $crypto; public function __construct(View $view, IUserManager $userManager, IConfig $config, Util $util, ICrypto $crypto) { parent::__construct(); @@ -85,14 +72,14 @@ class MigrateKeyStorage extends Command { } /** - * move keys to new key storage root + * Move keys to new key storage root * * @param string $root * @param OutputInterface $output * @return bool * @throws \Exception */ - protected function updateKeys(string $root, OutputInterface $output) { + protected function updateKeys(string $root, OutputInterface $output): bool { $output->writeln("Start to update the keys:"); $this->updateSystemKeys($root); @@ -102,11 +89,9 @@ class MigrateKeyStorage extends Command { } /** - * move system key folder - * - * @param string $root + * Move system key folder */ - protected function updateSystemKeys($root) { + protected function updateSystemKeys(string $root): void { if (!$this->rootView->is_dir($root . '/files_encryption')) { return; } @@ -119,40 +104,31 @@ class MigrateKeyStorage extends Command { foreach ($listing as $node) { if ($node['mimetype'] === 'httpd/unix-directory') { - //ignore - } else { - $endsWith = function ($haystack, $needle) { - $length = strlen($needle); - if ($length === 0) { - return true; - } + continue; + } - return (substr($haystack, -$length) === $needle); - }; + if ($node['name'] === 'fileKey' || + str_ends_with($node['name'], '.privateKey') || + str_ends_with($node['name'], '.publicKey') || + str_ends_with($node['name'], '.shareKey')) { + $path = $folder . '/' . $node['name']; - if ($node['name'] === 'fileKey' || - $endsWith($node['name'], '.privateKey') || - $endsWith($node['name'], '.publicKey') || - $endsWith($node['name'], '.shareKey')) { - $path = $folder . '/' . $node['name']; + $content = $this->rootView->file_get_contents($path); - $content = $this->rootView->file_get_contents($path); - - try { - $this->crypto->decrypt($content); - continue; - } catch (\Exception $e) { - // Ignore we now update the data. - } + try { + $this->crypto->decrypt($content); + continue; + } catch (\Exception $e) { + // Ignore we now update the data. + } - $data = [ - 'key' => base64_encode($content), - 'uid' => $uid, - ]; + $data = [ + 'key' => base64_encode($content), + 'uid' => $uid, + ]; - $enc = $this->crypto->encrypt(json_encode($data)); - $this->rootView->file_put_contents($path, $enc); - } + $enc = $this->crypto->encrypt(json_encode($data)); + $this->rootView->file_put_contents($path, $enc); } } } diff --git a/core/Command/Encryption/SetDefaultModule.php b/core/Command/Encryption/SetDefaultModule.php index 0b8b4ce5891..b50e004867f 100644 --- a/core/Command/Encryption/SetDefaultModule.php +++ b/core/Command/Encryption/SetDefaultModule.php @@ -31,16 +31,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class SetDefaultModule extends Command { - /** @var IManager */ - protected $encryptionManager; + protected IManager $encryptionManager; + protected IConfig $config; - /** @var IConfig */ - protected $config; - - /** - * @param IManager $encryptionManager - * @param IConfig $config - */ public function __construct( IManager $encryptionManager, IConfig $config diff --git a/core/Command/Encryption/ShowKeyStorageRoot.php b/core/Command/Encryption/ShowKeyStorageRoot.php index 1ac882645d5..1c4f2b4cb4a 100644 --- a/core/Command/Encryption/ShowKeyStorageRoot.php +++ b/core/Command/Encryption/ShowKeyStorageRoot.php @@ -29,13 +29,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ShowKeyStorageRoot extends Command { + protected Util $util; - /** @var Util */ - protected $util; - - /** - * @param Util $util - */ public function __construct(Util $util) { parent::__construct(); $this->util = $util; diff --git a/core/Command/Encryption/Status.php b/core/Command/Encryption/Status.php index 0db34c77f61..34ebabe1b73 100644 --- a/core/Command/Encryption/Status.php +++ b/core/Command/Encryption/Status.php @@ -27,12 +27,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Status extends Base { - /** @var IManager */ - protected $encryptionManager; + protected IManager $encryptionManager; - /** - * @param IManager $encryptionManager - */ public function __construct(IManager $encryptionManager) { parent::__construct(); $this->encryptionManager = $encryptionManager; diff --git a/core/Command/Group/Add.php b/core/Command/Group/Add.php index 56f5f08c659..d205cef0696 100644 --- a/core/Command/Group/Add.php +++ b/core/Command/Group/Add.php @@ -36,12 +36,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Add extends Base { - /** @var IGroupManager */ - protected $groupManager; + protected IGroupManager $groupManager; - /** - * @param IGroupManager $groupManager - */ public function __construct(IGroupManager $groupManager) { $this->groupManager = $groupManager; parent::__construct(); diff --git a/core/Command/Group/AddUser.php b/core/Command/Group/AddUser.php index 141916953ab..6638bcd4c6d 100644 --- a/core/Command/Group/AddUser.php +++ b/core/Command/Group/AddUser.php @@ -34,15 +34,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class AddUser extends Base { - /** @var IUserManager */ - protected $userManager; - /** @var IGroupManager */ - protected $groupManager; + protected IUserManager $userManager; + protected IGroupManager $groupManager; - /** - * @param IUserManager $userManager - * @param IGroupManager $groupManager - */ public function __construct(IUserManager $userManager, IGroupManager $groupManager) { $this->userManager = $userManager; $this->groupManager = $groupManager; diff --git a/core/Command/Group/Delete.php b/core/Command/Group/Delete.php index 2596b461d17..fd1074d6f61 100644 --- a/core/Command/Group/Delete.php +++ b/core/Command/Group/Delete.php @@ -35,12 +35,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Delete extends Base { - /** @var IGroupManager */ - protected $groupManager; + protected IGroupManager $groupManager; - /** - * @param IGroupManager $groupManager - */ public function __construct(IGroupManager $groupManager) { $this->groupManager = $groupManager; parent::__construct(); diff --git a/core/Command/Group/Info.php b/core/Command/Group/Info.php index 5e9fa661130..dc475581ac5 100644 --- a/core/Command/Group/Info.php +++ b/core/Command/Group/Info.php @@ -35,12 +35,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Info extends Base { - /** @var IGroupManager */ - protected $groupManager; + protected IGroupManager $groupManager; - /** - * @param IGroupManager $groupManager - */ public function __construct(IGroupManager $groupManager) { $this->groupManager = $groupManager; parent::__construct(); diff --git a/core/Command/Group/ListCommand.php b/core/Command/Group/ListCommand.php index db7493fe8d4..5100a00c60a 100644 --- a/core/Command/Group/ListCommand.php +++ b/core/Command/Group/ListCommand.php @@ -32,12 +32,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class ListCommand extends Base { - /** @var IGroupManager */ - protected $groupManager; + protected IGroupManager $groupManager; - /** - * @param IGroupManager $groupManager - */ public function __construct(IGroupManager $groupManager) { $this->groupManager = $groupManager; parent::__construct(); diff --git a/core/Command/Group/RemoveUser.php b/core/Command/Group/RemoveUser.php index 2b9c4eaec52..c7b3a2d84e7 100644 --- a/core/Command/Group/RemoveUser.php +++ b/core/Command/Group/RemoveUser.php @@ -34,15 +34,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class RemoveUser extends Base { - /** @var IUserManager */ - protected $userManager; - /** @var IGroupManager */ - protected $groupManager; + protected IUserManager $userManager; + protected IGroupManager $groupManager; - /** - * @param IUserManager $userManager - * @param IGroupManager $groupManager - */ public function __construct(IUserManager $userManager, IGroupManager $groupManager) { $this->userManager = $userManager; $this->groupManager = $groupManager; diff --git a/core/Command/Integrity/CheckApp.php b/core/Command/Integrity/CheckApp.php index 17e22cc5a62..ebd502c3d29 100644 --- a/core/Command/Integrity/CheckApp.php +++ b/core/Command/Integrity/CheckApp.php @@ -40,11 +40,7 @@ use Symfony\Component\Console\Output\OutputInterface; * @package OC\Core\Command\Integrity */ class CheckApp extends Base { - - /** - * @var Checker - */ - private $checker; + private Checker $checker; public function __construct(Checker $checker) { parent::__construct(); diff --git a/core/Command/Integrity/CheckCore.php b/core/Command/Integrity/CheckCore.php index eae33c09d76..9436786cad9 100644 --- a/core/Command/Integrity/CheckCore.php +++ b/core/Command/Integrity/CheckCore.php @@ -36,10 +36,7 @@ use Symfony\Component\Console\Output\OutputInterface; * @package OC\Core\Command\Integrity */ class CheckCore extends Base { - /** - * @var Checker - */ - private $checker; + private Checker $checker; public function __construct(Checker $checker) { parent::__construct(); diff --git a/core/Command/Integrity/SignApp.php b/core/Command/Integrity/SignApp.php index 0938303d008..8492511d597 100644 --- a/core/Command/Integrity/SignApp.php +++ b/core/Command/Integrity/SignApp.php @@ -40,18 +40,10 @@ use Symfony\Component\Console\Output\OutputInterface; * @package OC\Core\Command\Integrity */ class SignApp extends Command { - /** @var Checker */ - private $checker; - /** @var FileAccessHelper */ - private $fileAccessHelper; - /** @var IURLGenerator */ - private $urlGenerator; + private Checker $checker; + private FileAccessHelper $fileAccessHelper; + private IURLGenerator $urlGenerator; - /** - * @param Checker $checker - * @param FileAccessHelper $fileAccessHelper - * @param IURLGenerator $urlGenerator - */ public function __construct(Checker $checker, FileAccessHelper $fileAccessHelper, IURLGenerator $urlGenerator) { diff --git a/core/Command/Integrity/SignCore.php b/core/Command/Integrity/SignCore.php index c3b88b2116a..55d356fcd6b 100644 --- a/core/Command/Integrity/SignCore.php +++ b/core/Command/Integrity/SignCore.php @@ -39,15 +39,9 @@ use Symfony\Component\Console\Output\OutputInterface; * @package OC\Core\Command\Integrity */ class SignCore extends Command { - /** @var Checker */ - private $checker; - /** @var FileAccessHelper */ - private $fileAccessHelper; + private Checker $checker; + private FileAccessHelper $fileAccessHelper; - /** - * @param Checker $checker - * @param FileAccessHelper $fileAccessHelper - */ public function __construct(Checker $checker, FileAccessHelper $fileAccessHelper) { parent::__construct(null); diff --git a/core/Command/Log/File.php b/core/Command/Log/File.php index cd22b8917c4..f2c77e20174 100644 --- a/core/Command/Log/File.php +++ b/core/Command/Log/File.php @@ -36,9 +36,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class File extends Command implements Completion\CompletionAwareInterface { - - /** @var IConfig */ - protected $config; + protected IConfig $config; public function __construct(IConfig $config) { $this->config = $config; diff --git a/core/Command/Log/Manage.php b/core/Command/Log/Manage.php index 4c7e7dd8497..34ec5ea54a8 100644 --- a/core/Command/Log/Manage.php +++ b/core/Command/Log/Manage.php @@ -39,8 +39,7 @@ class Manage extends Command implements CompletionAwareInterface { public const DEFAULT_LOG_LEVEL = 2; public const DEFAULT_TIMEZONE = 'UTC'; - /** @var IConfig */ - protected $config; + protected IConfig $config; public function __construct(IConfig $config) { $this->config = $config; diff --git a/core/Command/Maintenance/DataFingerprint.php b/core/Command/Maintenance/DataFingerprint.php index 2bd1b9270bb..a57dc307b18 100644 --- a/core/Command/Maintenance/DataFingerprint.php +++ b/core/Command/Maintenance/DataFingerprint.php @@ -29,11 +29,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class DataFingerprint extends Command { - - /** @var IConfig */ - protected $config; - /** @var ITimeFactory */ - protected $timeFactory; + protected IConfig $config; + protected ITimeFactory $timeFactory; public function __construct(IConfig $config, ITimeFactory $timeFactory) { diff --git a/core/Command/Maintenance/Install.php b/core/Command/Maintenance/Install.php index d98ec870e37..c445f2c2f46 100644 --- a/core/Command/Maintenance/Install.php +++ b/core/Command/Maintenance/Install.php @@ -47,11 +47,8 @@ use Throwable; use function get_class; class Install extends Command { - - /** @var SystemConfig */ - private $config; - /** @var IniGetWrapper */ - private $iniGetWrapper; + private SystemConfig $config; + private IniGetWrapper $iniGetWrapper; public function __construct(SystemConfig $config, IniGetWrapper $iniGetWrapper) { parent::__construct(); diff --git a/core/Command/Maintenance/Mimetype/UpdateDB.php b/core/Command/Maintenance/Mimetype/UpdateDB.php index e2e3137927f..edc42c0fdcd 100644 --- a/core/Command/Maintenance/Mimetype/UpdateDB.php +++ b/core/Command/Maintenance/Mimetype/UpdateDB.php @@ -35,11 +35,8 @@ use Symfony\Component\Console\Output\OutputInterface; class UpdateDB extends Command { public const DEFAULT_MIMETYPE = 'application/octet-stream'; - /** @var IMimeTypeDetector */ - protected $mimetypeDetector; - - /** @var IMimeTypeLoader */ - protected $mimetypeLoader; + protected IMimeTypeDetector $mimetypeDetector; + protected IMimeTypeLoader $mimetypeLoader; public function __construct( IMimeTypeDetector $mimetypeDetector, diff --git a/core/Command/Maintenance/Mimetype/UpdateJS.php b/core/Command/Maintenance/Mimetype/UpdateJS.php index 042b4d5d62f..6a5a3d0ac61 100644 --- a/core/Command/Maintenance/Mimetype/UpdateJS.php +++ b/core/Command/Maintenance/Mimetype/UpdateJS.php @@ -31,9 +31,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class UpdateJS extends Command { - - /** @var IMimeTypeDetector */ - protected $mimetypeDetector; + protected IMimeTypeDetector $mimetypeDetector; public function __construct( IMimeTypeDetector $mimetypeDetector diff --git a/core/Command/Maintenance/Mode.php b/core/Command/Maintenance/Mode.php index 17580b8b331..c2af33aa4ed 100644 --- a/core/Command/Maintenance/Mode.php +++ b/core/Command/Maintenance/Mode.php @@ -33,9 +33,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Mode extends Command { - - /** @var IConfig */ - protected $config; + protected IConfig $config; public function __construct(IConfig $config) { $this->config = $config; diff --git a/core/Command/Maintenance/Repair.php b/core/Command/Maintenance/Repair.php index 2a3d7a908e2..aa0f6a2a086 100644 --- a/core/Command/Maintenance/Repair.php +++ b/core/Command/Maintenance/Repair.php @@ -40,25 +40,13 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; class Repair extends Command { - /** @var \OC\Repair $repair */ - protected $repair; - /** @var IConfig */ - protected $config; - /** @var EventDispatcherInterface */ - private $dispatcher; - /** @var ProgressBar */ - private $progress; - /** @var OutputInterface */ - private $output; - /** @var IAppManager */ - private $appManager; + protected \OC\Repair $repair; + protected IConfig $config; + private EventDispatcherInterface $dispatcher; + private ProgressBar $progress; + private OutputInterface $output; + private IAppManager $appManager; - /** - * @param \OC\Repair $repair - * @param IConfig $config - * @param EventDispatcherInterface $dispatcher - * @param IAppManager $appManager - */ public function __construct(\OC\Repair $repair, IConfig $config, EventDispatcherInterface $dispatcher, IAppManager $appManager) { $this->repair = $repair; $this->config = $config; diff --git a/core/Command/Maintenance/UpdateTheme.php b/core/Command/Maintenance/UpdateTheme.php index 10526fd54e6..e469b218b3f 100644 --- a/core/Command/Maintenance/UpdateTheme.php +++ b/core/Command/Maintenance/UpdateTheme.php @@ -33,12 +33,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class UpdateTheme extends UpdateJS { - - /** @var IMimeTypeDetector */ - protected $mimetypeDetector; - - /** @var ICacheFactory */ - protected $cacheFactory; + protected IMimeTypeDetector $mimetypeDetector; + protected ICacheFactory $cacheFactory; public function __construct( IMimeTypeDetector $mimetypeDetector, diff --git a/core/Command/Preview/Repair.php b/core/Command/Preview/Repair.php index c9cf204bf6c..650f80f99d0 100644 --- a/core/Command/Preview/Repair.php +++ b/core/Command/Preview/Repair.php @@ -32,9 +32,9 @@ use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\IConfig; -use OCP\ILogger; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; +use Psr\Log\LoggerInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputInterface; @@ -43,29 +43,21 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; class Repair extends Command { - /** @var IConfig */ - protected $config; - /** @var IRootFolder */ - private $rootFolder; - /** @var ILogger */ - private $logger; - - /** @var bool */ - private $stopSignalReceived = false; - /** @var int */ - private $memoryLimit; - /** @var int */ - private $memoryTreshold; - /** @var ILockingProvider */ - private $lockingProvider; - - public function __construct(IConfig $config, IRootFolder $rootFolder, ILogger $logger, IniGetWrapper $phpIni, ILockingProvider $lockingProvider) { + protected IConfig $config; + private IRootFolder $rootFolder; + private LoggerInterface $logger; + private bool $stopSignalReceived = false; + private int $memoryLimit; + private int $memoryTreshold; + private ILockingProvider $lockingProvider; + + public function __construct(IConfig $config, IRootFolder $rootFolder, LoggerInterface $logger, IniGetWrapper $phpIni, ILockingProvider $lockingProvider) { $this->config = $config; $this->rootFolder = $rootFolder; $this->logger = $logger; $this->lockingProvider = $lockingProvider; - $this->memoryLimit = $phpIni->getBytes('memory_limit'); + $this->memoryLimit = (int)$phpIni->getBytes('memory_limit'); $this->memoryTreshold = $this->memoryLimit - 25 * 1024 * 1024; parent::__construct(); @@ -265,27 +257,36 @@ class Repair extends Command { $section1->writeln(" Delete preview/$name/$previewName", OutputInterface::VERBOSITY_VERBOSE); $preview->delete(); } catch (\Exception $e) { - $this->logger->logException($e, ['app' => 'core', 'message' => "Failed to delete preview at preview/$name/$previewName"]); + $this->logger->error("Failed to delete preview at preview/$name/$previewName", [ + 'app' => 'core', + 'exception' => $e, + ]); } } else { try { $section1->writeln(" Move preview/$name/$previewName to preview/$newFoldername", OutputInterface::VERBOSITY_VERBOSE); $preview->move("appdata_$instanceId/preview/$newFoldername/$previewName"); } catch (\Exception $e) { - $this->logger->logException($e, ['app' => 'core', 'message' => "Failed to move preview from preview/$name/$previewName to preview/$newFoldername"]); + $this->logger->error("Failed to move preview from preview/$name/$previewName to preview/$newFoldername", [ + 'app' => 'core', + 'exception' => $e, + ]); } } } } } - + if ($oldPreviewFolder->getDirectoryListing() === []) { $section1->writeln(" Delete empty folder preview/$name", OutputInterface::VERBOSITY_VERBOSE); if (!$dryMode) { try { $oldPreviewFolder->delete(); } catch (\Exception $e) { - $this->logger->logException($e, ['app' => 'core', 'message' => "Failed to delete empty folder preview/$name"]); + $this->logger->error("Failed to delete empty folder preview/$name", [ + 'app' => 'core', + 'exception' => $e, + ]); } } } diff --git a/core/Command/Preview/ResetRenderedTexts.php b/core/Command/Preview/ResetRenderedTexts.php index c5a6c383a0f..df623651f83 100644 --- a/core/Command/Preview/ResetRenderedTexts.php +++ b/core/Command/Preview/ResetRenderedTexts.php @@ -39,21 +39,11 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class ResetRenderedTexts extends Command { - - /** @var IDBConnection */ - protected $connection; - - /** @var IUserManager */ - protected $userManager; - - /** @var IAvatarManager */ - protected $avatarManager; - - /** @var Root */ - private $previewFolder; - - /** @var IMimeTypeLoader */ - private $mimeTypeLoader; + protected IDBConnection $connection; + protected IUserManager $userManager; + protected IAvatarManager $avatarManager; + private Root $previewFolder; + private IMimeTypeLoader $mimeTypeLoader; public function __construct(IDBConnection $connection, IUserManager $userManager, diff --git a/core/Command/Security/ImportCertificate.php b/core/Command/Security/ImportCertificate.php index 16eae0dd4b8..9db7889e307 100644 --- a/core/Command/Security/ImportCertificate.php +++ b/core/Command/Security/ImportCertificate.php @@ -30,9 +30,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ImportCertificate extends Base { - - /** @var ICertificateManager */ - protected $certificateManager; + protected ICertificateManager $certificateManager; public function __construct(ICertificateManager $certificateManager) { $this->certificateManager = $certificateManager; diff --git a/core/Command/Security/ListCertificates.php b/core/Command/Security/ListCertificates.php index 9a99a2f6db6..15dd1812077 100644 --- a/core/Command/Security/ListCertificates.php +++ b/core/Command/Security/ListCertificates.php @@ -31,11 +31,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ListCertificates extends Base { - - /** @var ICertificateManager */ - protected $certificateManager; - /** @var IL10N */ - protected $l; + protected ICertificateManager $certificateManager; + protected IL10N $l; public function __construct(ICertificateManager $certificateManager, IL10N $l) { $this->certificateManager = $certificateManager; diff --git a/core/Command/Security/RemoveCertificate.php b/core/Command/Security/RemoveCertificate.php index f915bed5b64..2f9c6ff978a 100644 --- a/core/Command/Security/RemoveCertificate.php +++ b/core/Command/Security/RemoveCertificate.php @@ -30,9 +30,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class RemoveCertificate extends Base { - - /** @var ICertificateManager */ - protected $certificateManager; + protected ICertificateManager $certificateManager; public function __construct(ICertificateManager $certificateManager) { $this->certificateManager = $certificateManager; diff --git a/core/Command/Security/ResetBruteforceAttempts.php b/core/Command/Security/ResetBruteforceAttempts.php index 004fd8d8bdd..8def0873bdf 100644 --- a/core/Command/Security/ResetBruteforceAttempts.php +++ b/core/Command/Security/ResetBruteforceAttempts.php @@ -30,9 +30,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ResetBruteforceAttempts extends Base { - - /** @var Throttler */ - protected $throttler; + protected Throttler $throttler; public function __construct(Throttler $throttler) { $this->throttler = $throttler; diff --git a/core/Command/Status.php b/core/Command/Status.php index ad42c253c2c..45ccb28f5c4 100644 --- a/core/Command/Status.php +++ b/core/Command/Status.php @@ -32,11 +32,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Status extends Base { - - /** @var IConfig */ - private $config; - /** @var Defaults */ - private $themingDefaults; + private IConfig $config; + private Defaults $themingDefaults; public function __construct(IConfig $config, Defaults $themingDefaults) { parent::__construct('status'); diff --git a/core/Command/SystemTag/Add.php b/core/Command/SystemTag/Add.php index e5e7368946c..f4fb80eb70a 100644 --- a/core/Command/SystemTag/Add.php +++ b/core/Command/SystemTag/Add.php @@ -31,9 +31,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Add extends Base { - - /** @var ISystemTagManager */ - protected $systemTagManager; + protected ISystemTagManager $systemTagManager; public function __construct(ISystemTagManager $systemTagManager) { $this->systemTagManager = $systemTagManager; diff --git a/core/Command/SystemTag/Delete.php b/core/Command/SystemTag/Delete.php index 74cc895c251..4c1145ae1b4 100644 --- a/core/Command/SystemTag/Delete.php +++ b/core/Command/SystemTag/Delete.php @@ -30,9 +30,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Delete extends Base { - - /** @var ISystemTagManager */ - protected $systemTagManager; + protected ISystemTagManager $systemTagManager; public function __construct(ISystemTagManager $systemTagManager) { $this->systemTagManager = $systemTagManager; diff --git a/core/Command/SystemTag/Edit.php b/core/Command/SystemTag/Edit.php index 721ae42eb2b..7ed933c3b35 100644 --- a/core/Command/SystemTag/Edit.php +++ b/core/Command/SystemTag/Edit.php @@ -31,13 +31,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Edit extends Base { + protected ISystemTagManager $systemTagManager; - /** @var ISystemTagManager */ - protected $systemTagManager; - - /** - * @param ISystemTagManager $systemTagManager - */ public function __construct(ISystemTagManager $systemTagManager) { $this->systemTagManager = $systemTagManager; parent::__construct(); diff --git a/core/Command/SystemTag/ListCommand.php b/core/Command/SystemTag/ListCommand.php index f9d17efd513..06c39b4977a 100644 --- a/core/Command/SystemTag/ListCommand.php +++ b/core/Command/SystemTag/ListCommand.php @@ -30,9 +30,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class ListCommand extends Base { - - /** @var ISystemTagManager */ - protected $systemTagManager; + protected ISystemTagManager $systemTagManager; public function __construct(ISystemTagManager $systemTagManager) { $this->systemTagManager = $systemTagManager; diff --git a/core/Command/TwoFactorAuth/Base.php b/core/Command/TwoFactorAuth/Base.php index 94a3e5aeb60..27bd381d951 100644 --- a/core/Command/TwoFactorAuth/Base.php +++ b/core/Command/TwoFactorAuth/Base.php @@ -30,9 +30,7 @@ use OCP\IUserManager; use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; class Base extends \OC\Core\Command\Base { - - /** @var IUserManager */ - protected $userManager; + protected IUserManager $userManager; /** * Return possible values for the named option diff --git a/core/Command/TwoFactorAuth/Cleanup.php b/core/Command/TwoFactorAuth/Cleanup.php index b567ebe39a6..7d3fc3c33f7 100644 --- a/core/Command/TwoFactorAuth/Cleanup.php +++ b/core/Command/TwoFactorAuth/Cleanup.php @@ -32,9 +32,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Cleanup extends Base { - - /** @var IRegistry */ - private $registry; + private IRegistry $registry; public function __construct(IRegistry $registry) { parent::__construct(); diff --git a/core/Command/TwoFactorAuth/Disable.php b/core/Command/TwoFactorAuth/Disable.php index 3a8ce28a6b6..54e4b138a0a 100644 --- a/core/Command/TwoFactorAuth/Disable.php +++ b/core/Command/TwoFactorAuth/Disable.php @@ -29,12 +29,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Disable extends Base { - - /** @var ProviderManager */ - private $manager; - - /** @var IUserManager */ - protected $userManager; + private ProviderManager $manager; public function __construct(ProviderManager $manager, IUserManager $userManager) { parent::__construct('twofactorauth:disable'); diff --git a/core/Command/TwoFactorAuth/Enable.php b/core/Command/TwoFactorAuth/Enable.php index 1346c6c5df8..67c1778399d 100644 --- a/core/Command/TwoFactorAuth/Enable.php +++ b/core/Command/TwoFactorAuth/Enable.php @@ -29,12 +29,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Enable extends Base { - - /** @var ProviderManager */ - private $manager; - - /** @var IUserManager */ - protected $userManager; + private ProviderManager $manager; public function __construct(ProviderManager $manager, IUserManager $userManager) { parent::__construct('twofactorauth:enable'); diff --git a/core/Command/TwoFactorAuth/Enforce.php b/core/Command/TwoFactorAuth/Enforce.php index 7f75aec33d1..d8fa41e2e95 100644 --- a/core/Command/TwoFactorAuth/Enforce.php +++ b/core/Command/TwoFactorAuth/Enforce.php @@ -35,9 +35,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Enforce extends Command { - - /** @var MandatoryTwoFactor */ - private $mandatoryTwoFactor; + private MandatoryTwoFactor $mandatoryTwoFactor; public function __construct(MandatoryTwoFactor $mandatoryTwoFactor) { parent::__construct(); @@ -92,9 +90,6 @@ class Enforce extends Command { return 0; } - /** - * @param OutputInterface $output - */ protected function writeEnforced(OutputInterface $output, EnforcementState $state) { if (empty($state->getEnforcedGroups())) { $message = 'Two-factor authentication is enforced for all users'; @@ -107,9 +102,6 @@ class Enforce extends Command { $output->writeln($message); } - /** - * @param OutputInterface $output - */ protected function writeNotEnforced(OutputInterface $output) { $output->writeln('Two-factor authentication is not enforced'); } diff --git a/core/Command/TwoFactorAuth/State.php b/core/Command/TwoFactorAuth/State.php index 5120080cfb3..4694c76b408 100644 --- a/core/Command/TwoFactorAuth/State.php +++ b/core/Command/TwoFactorAuth/State.php @@ -33,9 +33,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class State extends Base { - - /** @var IRegistry */ - private $registry; + private IRegistry $registry; public function __construct(IRegistry $registry, IUserManager $userManager) { parent::__construct('twofactorauth:state'); diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php index 0591132e37f..acf0b503d19 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -53,14 +53,9 @@ class Upgrade extends Command { public const ERROR_INVALID_ARGUMENTS = 4; public const ERROR_FAILURE = 5; - /** @var IConfig */ - private $config; - - /** @var LoggerInterface */ - private $logger; - - /** @var Installer */ - private $installer; + private IConfig $config; + private LoggerInterface $logger; + private Installer $installer; public function __construct(IConfig $config, LoggerInterface $logger, Installer $installer) { parent::__construct(); diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php index 574be6e421c..24d11fbee6e 100644 --- a/core/Command/User/Add.php +++ b/core/Command/User/Add.php @@ -39,16 +39,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\Question; class Add extends Command { - /** @var \OCP\IUserManager */ - protected $userManager; + protected IUserManager $userManager; + protected IGroupManager $groupManager; - /** @var \OCP\IGroupManager */ - protected $groupManager; - - /** - * @param IUserManager $userManager - * @param IGroupManager $groupManager - */ public function __construct(IUserManager $userManager, IGroupManager $groupManager) { parent::__construct(); $this->userManager = $userManager; diff --git a/core/Command/User/AddAppPassword.php b/core/Command/User/AddAppPassword.php index 65b572533f5..ec39cdc974e 100644 --- a/core/Command/User/AddAppPassword.php +++ b/core/Command/User/AddAppPassword.php @@ -41,18 +41,10 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\Question; class AddAppPassword extends Command { - - /** @var IUserManager */ - protected $userManager; - - /** @var IProvider */ - protected $tokenProvider; - - /** @var ISecureRandom */ - private $random; - - /** @var IEventDispatcher */ - private $eventDispatcher; + protected IUserManager $userManager; + protected IProvider $tokenProvider; + private ISecureRandom $random; + private IEventDispatcher $eventDispatcher; public function __construct(IUserManager $userManager, IProvider $tokenProvider, diff --git a/core/Command/User/Disable.php b/core/Command/User/Disable.php index 9120d28cc1f..bc819f39e1d 100644 --- a/core/Command/User/Disable.php +++ b/core/Command/User/Disable.php @@ -32,12 +32,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Disable extends Base { - /** @var IUserManager */ - protected $userManager; + protected IUserManager $userManager; - /** - * @param IUserManager $userManager - */ public function __construct(IUserManager $userManager) { $this->userManager = $userManager; parent::__construct(); diff --git a/core/Command/User/Enable.php b/core/Command/User/Enable.php index eb548a74d7e..f4e16eec4af 100644 --- a/core/Command/User/Enable.php +++ b/core/Command/User/Enable.php @@ -32,12 +32,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Enable extends Base { - /** @var IUserManager */ - protected $userManager; + protected IUserManager $userManager; - /** - * @param IUserManager $userManager - */ public function __construct(IUserManager $userManager) { $this->userManager = $userManager; parent::__construct(); diff --git a/core/Command/User/Info.php b/core/Command/User/Info.php index a93f65b7dce..1e89a8d0911 100644 --- a/core/Command/User/Info.php +++ b/core/Command/User/Info.php @@ -35,15 +35,9 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Info extends Base { - /** @var IUserManager */ - protected $userManager; - /** @var IGroupManager */ - protected $groupManager; + protected IUserManager $userManager; + protected IGroupManager $groupManager; - /** - * @param IUserManager $userManager - * @param IGroupManager $groupManager - */ public function __construct(IUserManager $userManager, IGroupManager $groupManager) { $this->userManager = $userManager; $this->groupManager = $groupManager; diff --git a/core/Command/User/LastSeen.php b/core/Command/User/LastSeen.php index dc01ca549f3..5ea6c64d249 100644 --- a/core/Command/User/LastSeen.php +++ b/core/Command/User/LastSeen.php @@ -34,12 +34,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class LastSeen extends Base { - /** @var IUserManager */ - protected $userManager; + protected IUserManager $userManager; - /** - * @param IUserManager $userManager - */ public function __construct(IUserManager $userManager) { $this->userManager = $userManager; parent::__construct(); diff --git a/core/Command/User/ListCommand.php b/core/Command/User/ListCommand.php index 20422afbf9d..c254a8a11cf 100644 --- a/core/Command/User/ListCommand.php +++ b/core/Command/User/ListCommand.php @@ -33,17 +33,9 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class ListCommand extends Base { + protected IUserManager $userManager; + protected IGroupManager $groupManager; - /** @var IUserManager */ - protected $userManager; - - /** @var IGroupManager */ - protected $groupManager; - - /** - * @param IUserManager $userManager - * @param IGroupManager $groupManager - */ public function __construct(IUserManager $userManager, IGroupManager $groupManager) { $this->userManager = $userManager; diff --git a/core/Command/User/Report.php b/core/Command/User/Report.php index 149abc006f9..e080a617258 100644 --- a/core/Command/User/Report.php +++ b/core/Command/User/Report.php @@ -41,10 +41,8 @@ use Symfony\Component\Console\Output\OutputInterface; class Report extends Command { public const DEFAULT_COUNT_DIRS_MAX_USERS = 500; - /** @var IUserManager */ - protected $userManager; - /** @var IConfig */ - private $config; + protected IUserManager $userManager; + private IConfig $config; public function __construct(IUserManager $userManager, IConfig $config) { diff --git a/core/Command/User/ResetPassword.php b/core/Command/User/ResetPassword.php index 174a9f4068d..21bc5cc45b0 100644 --- a/core/Command/User/ResetPassword.php +++ b/core/Command/User/ResetPassword.php @@ -40,9 +40,7 @@ use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\Question; class ResetPassword extends Base { - - /** @var IUserManager */ - protected $userManager; + protected IUserManager $userManager; public function __construct(IUserManager $userManager) { $this->userManager = $userManager; diff --git a/core/Command/User/Setting.php b/core/Command/User/Setting.php index 3e4830127cd..6e7c15375d1 100644 --- a/core/Command/User/Setting.php +++ b/core/Command/User/Setting.php @@ -36,16 +36,9 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Setting extends Base { - /** @var IUserManager */ - protected $userManager; + protected IUserManager $userManager; + protected IConfig $config; - /** @var IConfig */ - protected $config; - - /** - * @param IUserManager $userManager - * @param IConfig $config - */ public function __construct(IUserManager $userManager, IConfig $config) { parent::__construct(); $this->userManager = $userManager; |