diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-04-12 18:55:01 +0300 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-05-20 23:18:06 +0300 |
commit | b70c6a128fe5d0053b7971881696eafce4cb7c26 (patch) | |
tree | 641ff76531803c207a92d86f47d46b6dd93ab6d3 /core | |
parent | 2b0d82675f669f00ad90f2750b1832a60ec9f766 (diff) |
Update core to PHP 7.4 standardcore-cleanup-74
- Typed properties
- Port to LoggerInterface
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'core')
120 files changed, 434 insertions, 1303 deletions
diff --git a/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php b/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php index d699eac3768..ceff579b1c7 100644 --- a/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php +++ b/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php @@ -28,23 +28,19 @@ namespace OC\Core\BackgroundJobs; use OC\BackgroundJob\QueuedJob; use OCP\IConfig; -use OCP\ILogger; +use Psr\Log\LoggerInterface; class BackgroundCleanupUpdaterBackupsJob extends QueuedJob { + protected IConfig $config; + protected LoggerInterface $log; - /** @var IConfig */ - protected $config; - /** @var ILogger */ - protected $log; - - public function __construct(IConfig $config, ILogger $log) { + public function __construct(IConfig $config, LoggerInterface $log) { $this->config = $config; $this->log = $log; } /** * This job cleans up all backups except the latest 3 from the updaters backup directory - * */ public function run($arguments) { $dataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'); diff --git a/core/BackgroundJobs/CheckForUserCertificates.php b/core/BackgroundJobs/CheckForUserCertificates.php index 6bc3f1c4681..492fadde854 100644 --- a/core/BackgroundJobs/CheckForUserCertificates.php +++ b/core/BackgroundJobs/CheckForUserCertificates.php @@ -35,13 +35,9 @@ use OCP\IUser; use OCP\IUserManager; class CheckForUserCertificates extends QueuedJob { - - /** @var IConfig */ - protected $config; - /** @var IUserManager */ - private $userManager; - /** @var IRootFolder */ - private $rootFolder; + protected IConfig $config; + private IUserManager $userManager; + private IRootFolder $rootFolder; public function __construct(IConfig $config, IUserManager $userManager, IRootFolder $rootFolder) { $this->config = $config; diff --git a/core/BackgroundJobs/CleanupLoginFlowV2.php b/core/BackgroundJobs/CleanupLoginFlowV2.php index 919fbd7e653..27a5160a9d7 100644 --- a/core/BackgroundJobs/CleanupLoginFlowV2.php +++ b/core/BackgroundJobs/CleanupLoginFlowV2.php @@ -31,9 +31,7 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\TimedJob; class CleanupLoginFlowV2 extends TimedJob { - - /** @var LoginFlowV2Mapper */ - private $loginFlowV2Mapper; + private LoginFlowV2Mapper $loginFlowV2Mapper; public function __construct(ITimeFactory $time, LoginFlowV2Mapper $loginFlowV2Mapper) { parent::__construct($time); diff --git a/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php b/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php index 282c56f37f1..8945be11a1c 100644 --- a/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php +++ b/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php @@ -31,11 +31,8 @@ use OCP\IUser; use OCP\IUserManager; class LookupServerSendCheckBackgroundJob extends QueuedJob { - - /** @var IConfig */ - protected $config; - /** @var IUserManager */ - private $userManager; + protected IConfig $config; + private IUserManager $userManager; public function __construct(IConfig $config, IUserManager $userManager) { $this->config = $config; 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; diff --git a/core/Controller/AppPasswordController.php b/core/Controller/AppPasswordController.php index 41f0f6e4f27..3f254f03370 100644 --- a/core/Controller/AppPasswordController.php +++ b/core/Controller/AppPasswordController.php @@ -42,21 +42,11 @@ use OCP\ISession; use OCP\Security\ISecureRandom; class AppPasswordController extends \OCP\AppFramework\OCSController { - - /** @var ISession */ - private $session; - - /** @var ISecureRandom */ - private $random; - - /** @var IProvider */ - private $tokenProvider; - - /** @var IStore */ - private $credentialStore; - - /** @var IEventDispatcher */ - private $eventDispatcher; + private ISession $session; + private ISecureRandom $random; + private IProvider $tokenProvider; + private IStore $credentialStore; + private IEventDispatcher $eventDispatcher; public function __construct(string $appName, IRequest $request, @@ -77,7 +67,6 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { /** * @NoAdminRequired * - * @return DataResponse * @throws OCSForbiddenException */ public function getAppPassword(): DataResponse { @@ -123,10 +112,8 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { /** * @NoAdminRequired - * - * @return DataResponse */ - public function deleteAppPassword() { + public function deleteAppPassword(): DataResponse { if (!$this->session->exists('app_password')) { throw new OCSForbiddenException('no app password in use'); } diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 9f0e43dedd6..f7174456731 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -39,14 +39,9 @@ use OCP\IRequest; use OCP\Share\IShare; class AutoCompleteController extends Controller { - /** @var ISearch */ - private $collaboratorSearch; - - /** @var IManager */ - private $autoCompleteManager; - - /** @var IEventDispatcher */ - private $dispatcher; + private ISearch $collaboratorSearch; + private IManager $autoCompleteManager; + private IEventDispatcher $dispatcher; public function __construct(string $appName, IRequest $request, @@ -62,16 +57,9 @@ class AutoCompleteController extends Controller { /** * @NoAdminRequired - * - * @param string $search - * @param string $itemType - * @param string $itemId * @param string|null $sorter can be piped, top prio first, e.g.: "commenters|share-recipients" - * @param array $shareTypes - * @param int $limit - * @return DataResponse */ - public function get($search, $itemType, $itemId, $sorter = null, $shareTypes = [IShare::TYPE_USER], $limit = 10): DataResponse { + public function get(string $search, ?string $itemType, ?string $itemId, ?string $sorter = null, array $shareTypes = [IShare::TYPE_USER], int $limit = 10): DataResponse { // if enumeration/user listings are disabled, we'll receive an empty // result from search() – thus nothing else to do here. [$results,] = $this->collaboratorSearch->search($search, $shareTypes, false, $limit, 0); @@ -106,7 +94,6 @@ class AutoCompleteController extends Controller { return new DataResponse($results); } - protected function prepareResultArray(array $results): array { $output = []; foreach ($results as $type => $subResult) { diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index d8c9745c139..e75b3493185 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -41,10 +41,10 @@ use OCP\Files\IRootFolder; use OCP\IAvatarManager; use OCP\ICache; use OCP\IL10N; -use OCP\ILogger; use OCP\IRequest; use OCP\IUserManager; use OCP\IUserSession; +use Psr\Log\LoggerInterface; /** * Class AvatarController @@ -52,43 +52,25 @@ use OCP\IUserSession; * @package OC\Core\Controller */ class AvatarController extends Controller { - - /** @var IAvatarManager */ - protected $avatarManager; - - /** @var ICache */ - protected $cache; - - /** @var IL10N */ - protected $l; - - /** @var IUserManager */ - protected $userManager; - - /** @var IUserSession */ - protected $userSession; - - /** @var IRootFolder */ - protected $rootFolder; - - /** @var ILogger */ - protected $logger; - - /** @var string */ - protected $userId; - - /** @var TimeFactory */ - protected $timeFactory; - - public function __construct($appName, + protected IAvatarManager $avatarManager; + protected ICache $cache; + protected IL10N $l; + protected IUserManager $userManager; + protected IUserSession $userSession; + protected IRootFolder $rootFolder; + protected LoggerInterface $logger; + protected ?string $userId; + protected TimeFactory $timeFactory; + + public function __construct(string $appName, IRequest $request, IAvatarManager $avatarManager, ICache $cache, IL10N $l10n, IUserManager $userManager, IRootFolder $rootFolder, - ILogger $logger, - $userId, + LoggerInterface $logger, + ?string $userId, TimeFactory $timeFactory) { parent::__construct($appName, $request); @@ -109,11 +91,9 @@ class AvatarController extends Controller { * @NoSameSiteCookieRequired * @PublicPage * - * @param string $userId - * @param int $size * @return JSONResponse|FileDisplayResponse */ - public function getAvatar($userId, $size) { + public function getAvatar(string $userId, int $size) { if ($size <= 64) { if ($size !== 64) { $this->logger->debug('Avatar requested in deprecated size ' . $size); @@ -145,11 +125,8 @@ class AvatarController extends Controller { /** * @NoAdminRequired - * - * @param string $path - * @return JSONResponse */ - public function postAvatar($path) { + public function postAvatar(?string $path = null): JSONResponse { $files = $this->request->getUploadedFile('files'); if (isset($path)) { @@ -250,23 +227,21 @@ class AvatarController extends Controller { ); } } catch (\Exception $e) { - $this->logger->logException($e, ['app' => 'core']); + $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']); return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_OK); } } /** * @NoAdminRequired - * - * @return JSONResponse */ - public function deleteAvatar() { + public function deleteAvatar(): JSONResponse { try { $avatar = $this->avatarManager->getAvatar($this->userId); $avatar->remove(); return new JSONResponse(); } catch (\Exception $e) { - $this->logger->logException($e, ['app' => 'core']); + $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']); return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST); } } @@ -301,11 +276,8 @@ class AvatarController extends Controller { /** * @NoAdminRequired - * - * @param array $crop - * @return JSONResponse */ - public function postCroppedAvatar($crop) { + public function postCroppedAvatar(?array $crop = null): JSONResponse { if (is_null($crop)) { return new JSONResponse(['data' => ['message' => $this->l->t("No crop data provided")]], Http::STATUS_BAD_REQUEST); @@ -337,7 +309,7 @@ class AvatarController extends Controller { return new JSONResponse(['data' => ['message' => $this->l->t('Crop is not square')]], Http::STATUS_BAD_REQUEST); } catch (\Exception $e) { - $this->logger->logException($e, ['app' => 'core']); + $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']); return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST); } } diff --git a/core/Controller/CSRFTokenController.php b/core/Controller/CSRFTokenController.php index 510d5e64d9f..16288a8b318 100644 --- a/core/Controller/CSRFTokenController.php +++ b/core/Controller/CSRFTokenController.php @@ -33,15 +33,8 @@ use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; class CSRFTokenController extends Controller { + private CsrfTokenManager $tokenManager; - /** @var CsrfTokenManager */ - private $tokenManager; - - /** - * @param string $appName - * @param IRequest $request - * @param CsrfTokenManager $tokenManager - */ public function __construct(string $appName, IRequest $request, CsrfTokenManager $tokenManager) { parent::__construct($appName, $request); @@ -52,7 +45,6 @@ class CSRFTokenController extends Controller { * @NoAdminRequired * @NoCSRFRequired * @PublicPage - * @return JSONResponse */ public function index(): JSONResponse { if (!$this->request->passesStrictCookieCheck()) { diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index d24a49ee376..4c262714fe6 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -56,47 +56,21 @@ use OCP\Security\ISecureRandom; use OCP\Session\Exceptions\SessionNotAvailableException; class ClientFlowLoginController extends Controller { - /** @var IUserSession */ - private $userSession; - /** @var IL10N */ - private $l10n; - /** @var Defaults */ - private $defaults; - /** @var ISession */ - private $session; - /** @var IProvider */ - private $tokenProvider; - /** @var ISecureRandom */ - private $random; - /** @var IURLGenerator */ - private $urlGenerator; - /** @var ClientMapper */ - private $clientMapper; - /** @var AccessTokenMapper */ - private $accessTokenMapper; - /** @var ICrypto */ - private $crypto; - /** @var IEventDispatcher */ - private $eventDispatcher; + private IUserSession $userSession; + private IL10N $l10n; + private Defaults $defaults; + private ISession $session; + private IProvider $tokenProvider; + private ISecureRandom $random; + private IURLGenerator $urlGenerator; + private ClientMapper $clientMapper; + private AccessTokenMapper $accessTokenMapper; + private ICrypto $crypto; + private IEventDispatcher $eventDispatcher; public const STATE_NAME = 'client.flow.state.token'; - /** - * @param string $appName - * @param IRequest $request - * @param IUserSession $userSession - * @param IL10N $l10n - * @param Defaults $defaults - * @param ISession $session - * @param IProvider $tokenProvider - * @param ISecureRandom $random - * @param IURLGenerator $urlGenerator - * @param ClientMapper $clientMapper - * @param AccessTokenMapper $accessTokenMapper - * @param ICrypto $crypto - * @param IEventDispatcher $eventDispatcher - */ - public function __construct($appName, + public function __construct(string $appName, IRequest $request, IUserSession $userSession, IL10N $l10n, @@ -123,30 +97,20 @@ class ClientFlowLoginController extends Controller { $this->eventDispatcher = $eventDispatcher; } - /** - * @return string - */ - private function getClientName() { + private function getClientName(): string { $userAgent = $this->request->getHeader('USER_AGENT'); return $userAgent !== '' ? $userAgent : 'unknown'; } - /** - * @param string $stateToken - * @return bool - */ - private function isValidToken($stateToken) { + private function isValidToken(string $stateToken): bool { $currentToken = $this->session->get(self::STATE_NAME); - if (!is_string($stateToken) || !is_string($currentToken)) { + if (!is_string($currentToken)) { return false; } return hash_equals($currentToken, $stateToken); } - /** - * @return StandaloneTemplateResponse - */ - private function stateTokenForbiddenResponse() { + private function stateTokenForbiddenResponse(): StandaloneTemplateResponse { $response = new StandaloneTemplateResponse( $this->appName, '403', @@ -281,12 +245,10 @@ class ClientFlowLoginController extends Controller { * @NoAdminRequired * @UseSession * - * @param string $stateToken - * @param string $clientIdentifier * @return Http\RedirectResponse|Response */ - public function generateAppPassword($stateToken, - $clientIdentifier = '') { + public function generateAppPassword(string $stateToken, + string $clientIdentifier = '') { if (!$this->isValidToken($stateToken)) { $this->session->remove(self::STATE_NAME); return $this->stateTokenForbiddenResponse(); @@ -375,7 +337,7 @@ class ClientFlowLoginController extends Controller { /** * @PublicPage */ - public function apptokenRedirect(string $stateToken, string $user, string $password) { + public function apptokenRedirect(string $stateToken, string $user, string $password): Response { if (!$this->isValidToken($stateToken)) { return $this->stateTokenForbiddenResponse(); } diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index 27585cbdb7e..3c57b190593 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -50,22 +50,14 @@ class ClientFlowLoginV2Controller extends Controller { public const TOKEN_NAME = 'client.flow.v2.login.token'; public const STATE_NAME = 'client.flow.v2.state.token'; - /** @var LoginFlowV2Service */ - private $loginFlowV2Service; - /** @var IURLGenerator */ - private $urlGenerator; - /** @var ISession */ - private $session; - /** @var IUserSession */ - private $userSession; - /** @var ISecureRandom */ - private $random; - /** @var Defaults */ - private $defaults; - /** @var string */ - private $userId; - /** @var IL10N */ - private $l10n; + private LoginFlowV2Service $loginFlowV2Service; + private IURLGenerator $urlGenerator; + private IUserSession $userSession; + private ISession $session; + private ISecureRandom $random; + private Defaults $defaults; + private ?string $userId; + private IL10N $l10n; public function __construct(string $appName, IRequest $request, diff --git a/core/Controller/CollaborationResourcesController.php b/core/Controller/CollaborationResourcesController.php index 114423e1a2f..659ff32baee 100644 --- a/core/Controller/CollaborationResourcesController.php +++ b/core/Controller/CollaborationResourcesController.php @@ -36,25 +36,21 @@ use OCP\Collaboration\Resources\ICollection; use OCP\Collaboration\Resources\IManager; use OCP\Collaboration\Resources\IResource; use OCP\Collaboration\Resources\ResourceException; -use OCP\ILogger; use OCP\IRequest; use OCP\IUserSession; +use Psr\Log\LoggerInterface; class CollaborationResourcesController extends OCSController { - - /** @var IManager */ - private $manager; - /** @var IUserSession */ - private $userSession; - /** @var ILogger */ - private $logger; + private IManager $manager; + private IUserSession $userSession; + private LoggerInterface $logger; public function __construct( string $appName, IRequest $request, IManager $manager, IUserSession $userSession, - ILogger $logger + LoggerInterface $logger ) { parent::__construct($appName, $request); @@ -240,7 +236,7 @@ class CollaborationResourcesController extends OCSController { } catch (CollectionException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); } catch (Exception $e) { - $this->logger->logException($e); + $this->logger->critical($e->getMessage(), ['exception' => $e, 'app' => 'core']); return new DataResponse([], Http::STATUS_INTERNAL_SERVER_ERROR); } } @@ -253,7 +249,7 @@ class CollaborationResourcesController extends OCSController { $result[] = $this->prepareCollection($collection); } catch (CollectionException $e) { } catch (Exception $e) { - $this->logger->logException($e); + $this->logger->critical($e->getMessage(), ['exception' => $e, 'app' => 'core']); } } @@ -280,7 +276,7 @@ class CollaborationResourcesController extends OCSController { $result[] = $this->prepareResource($resource); } catch (ResourceException $e) { } catch (Exception $e) { - $this->logger->logException($e); + $this->logger->critical($e->getMessage(), ['exception' => $e, 'app' => 'core']); } } diff --git a/core/Controller/CssController.php b/core/Controller/CssController.php index e1d7d5178cd..4cd2996835e 100644 --- a/core/Controller/CssController.php +++ b/core/Controller/CssController.php @@ -44,12 +44,8 @@ use OCP\Files\SimpleFS\ISimpleFolder; use OCP\IRequest; class CssController extends Controller { - - /** @var IAppData */ - protected $appData; - - /** @var ITimeFactory */ - protected $timeFactory; + protected IAppData $appData; + protected ITimeFactory $timeFactory; public function __construct(string $appName, IRequest $request, diff --git a/core/Controller/GuestAvatarController.php b/core/Controller/GuestAvatarController.php index 6d14474ed44..9c0606f368f 100644 --- a/core/Controller/GuestAvatarController.php +++ b/core/Controller/GuestAvatarController.php @@ -26,37 +26,24 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\FileDisplayResponse; use OCP\IAvatarManager; -use OCP\ILogger; use OCP\IRequest; +use Psr\Log\LoggerInterface; /** * This controller handles guest avatar requests. */ class GuestAvatarController extends Controller { - - /** - * @var ILogger - */ - private $logger; - - /** - * @var IAvatarManager - */ - private $avatarManager; + private LoggerInterface $logger; + private IAvatarManager $avatarManager; /** * GuestAvatarController constructor. - * - * @param $appName - * @param IRequest $request - * @param IAvatarManager $avatarManager - * @param ILogger $logger */ public function __construct( - $appName, + string $appName, IRequest $request, IAvatarManager $avatarManager, - ILogger $logger + LoggerInterface $logger ) { parent::__construct($appName, $request); $this->avatarManager = $avatarManager; @@ -73,7 +60,7 @@ class GuestAvatarController extends Controller { * @param string $size The desired avatar size, e.g. 64 for 64x64px * @return FileDisplayResponse|Http\Response */ - public function getAvatar($guestName, $size) { + public function getAvatar(string $guestName, string $size) { $size = (int) $size; if ($size <= 64) { diff --git a/core/Controller/HoverCardController.php b/core/Controller/HoverCardController.php index cb85da112a4..632cdd0d02f 100644 --- a/core/Controller/HoverCardController.php +++ b/core/Controller/HoverCardController.php @@ -33,18 +33,9 @@ use OCP\IUserSession; use OCP\Share\IShare; class HoverCardController extends \OCP\AppFramework\OCSController { + private Manager $manager; + private IUserSession $userSession; - /** @var Manager */ - private $manager; - - /** @var IUserSession */ - private $userSession; - - /** - * @param IRequest $request - * @param IUserSession $userSession - * @param Manager $manager - */ public function __construct(IRequest $request, IUserSession $userSession, Manager $manager) { parent::__construct('core', $request); $this->userSession = $userSession; @@ -53,9 +44,6 @@ class HoverCardController extends \OCP\AppFramework\OCSController { /** * @NoAdminRequired - * - * @param string $userId - * @return DataResponse */ public function getUser(string $userId): DataResponse { $contact = $this->manager->findOne($this->userSession->getUser(), IShare::TYPE_USER, $userId); diff --git a/core/Controller/JsController.php b/core/Controller/JsController.php index 937df073e81..885de5491e7 100644 --- a/core/Controller/JsController.php +++ b/core/Controller/JsController.php @@ -44,12 +44,8 @@ use OCP\Files\SimpleFS\ISimpleFolder; use OCP\IRequest; class JsController extends Controller { - - /** @var IAppData */ - protected $appData; - - /** @var ITimeFactory */ - protected $timeFactory; + protected IAppData $appData; + protected ITimeFactory $timeFactory; public function __construct($appName, IRequest $request, Factory $appDataFactory, ITimeFactory $timeFactory) { parent::__construct($appName, $request); diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index b68f91f986e..ff2cb641f88 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -47,7 +47,6 @@ use OCP\Defaults; use OCP\IConfig; use OCP\IInitialStateService; use OCP\IL10N; -use OCP\ILogger; use OCP\IRequest; use OCP\ISession; use OCP\IURLGenerator; @@ -61,32 +60,19 @@ class LoginController extends Controller { public const LOGIN_MSG_INVALIDPASSWORD = 'invalidpassword'; public const LOGIN_MSG_USERDISABLED = 'userdisabled'; - /** @var IUserManager */ - private $userManager; - /** @var IConfig */ - private $config; - /** @var ISession */ - private $session; + private IUserManager $userManager; + private IConfig $config; + private ISession $session; /** @var IUserSession|Session */ private $userSession; - /** @var IURLGenerator */ - private $urlGenerator; - /** @var ILogger */ - private $logger; - /** @var Defaults */ - private $defaults; - /** @var Throttler */ - private $throttler; - /** @var Chain */ - private $loginChain; - /** @var IInitialStateService */ - private $initialStateService; - /** @var WebAuthnManager */ - private $webAuthnManager; - /** @var IManager */ - private $manager; - /** @var IL10N */ - private $l10n; + private IURLGenerator $urlGenerator; + private Defaults $defaults; + private Throttler $throttler; + private Chain $loginChain; + private IInitialStateService $initialStateService; + private WebAuthnManager $webAuthnManager; + private IManager $manager; + private IL10N $l10n; public function __construct(?string $appName, IRequest $request, @@ -95,7 +81,6 @@ class LoginController extends Controller { ISession $session, IUserSession $userSession, IURLGenerator $urlGenerator, - ILogger $logger, Defaults $defaults, Throttler $throttler, Chain $loginChain, @@ -109,7 +94,6 @@ class LoginController extends Controller { $this->session = $session; $this->userSession = $userSession; $this->urlGenerator = $urlGenerator; - $this->logger = $logger; $this->defaults = $defaults; $this->throttler = $throttler; $this->loginChain = $loginChain; @@ -375,13 +359,10 @@ class LoginController extends Controller { * @UseSession * @BruteForceProtection(action=sudo) * - * @param string $password - * - * @return DataResponse * @license GNU AGPL version 3 or any later version * */ - public function confirmPassword($password) { + public function confirmPassword(string $password): DataResponse { $loginName = $this->userSession->getLoginName(); $loginResult = $this->userManager->checkPassword($loginName, $password); if ($loginResult === false) { diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index 87a629b9ee8..e0f16226bff 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -47,7 +47,6 @@ use OCP\HintException; use OCP\IConfig; use OCP\IInitialStateService; use OCP\IL10N; -use OCP\ILogger; use OCP\IRequest; use OCP\IURLGenerator; use OCP\IUser; @@ -55,6 +54,7 @@ use OCP\IUserManager; use OCP\Mail\IMailer; use OCP\Security\VerificationToken\InvalidTokenException; use OCP\Security\VerificationToken\IVerificationToken; +use Psr\Log\LoggerInterface; use function array_filter; use function count; use function reset; @@ -67,33 +67,21 @@ use function reset; * @package OC\Core\Controller */ class LostController extends Controller { - /** @var IURLGenerator */ - protected $urlGenerator; - /** @var IUserManager */ - protected $userManager; - /** @var Defaults */ - protected $defaults; - /** @var IL10N */ - protected $l10n; - /** @var string */ - protected $from; - /** @var IManager */ - protected $encryptionManager; - /** @var IConfig */ - protected $config; - /** @var IMailer */ - protected $mailer; - /** @var ILogger */ - private $logger; - /** @var Manager */ - private $twoFactorManager; - /** @var IInitialStateService */ - private $initialStateService; - /** @var IVerificationToken */ - private $verificationToken; + protected IURLGenerator $urlGenerator; + protected IUserManager $userManager; + protected Defaults $defaults; + protected IL10N $l10n; + protected string $from; + protected IManager $encryptionManager; + protected IConfig $config; + protected IMailer $mailer; + private LoggerInterface $logger; + private Manager $twoFactorManager; + private IInitialStateService $initialStateService; + private IVerificationToken $verificationToken; public function __construct( - $appName, + string $appName, IRequest $request, IURLGenerator $urlGenerator, IUserManager $userManager, @@ -103,7 +91,7 @@ class LostController extends Controller { $defaultMailAddress, IManager $encryptionManager, IMailer $mailer, - ILogger $logger, + LoggerInterface $logger, Manager $twoFactorManager, IInitialStateService $initialStateService, IVerificationToken $verificationToken @@ -128,12 +116,8 @@ class LostController extends Controller { * * @PublicPage * @NoCSRFRequired - * - * @param string $token - * @param string $userId - * @return TemplateResponse */ - public function resetform($token, $userId) { + public function resetform(string $token, string $userId): TemplateResponse { try { $this->checkPasswordResetToken($token, $userId); } catch (\Exception $e) { @@ -168,8 +152,6 @@ class LostController extends Controller { } /** - * @param string $token - * @param string $userId * @throws \Exception */ protected function checkPasswordResetToken(string $token, string $userId): void { @@ -184,20 +166,11 @@ class LostController extends Controller { } } - /** - * @param $message - * @param array $additional - * @return array - */ - private function error($message, array $additional = []) { + private function error(string $message, array $additional = []): array { return array_merge(['status' => 'error', 'msg' => $message], $additional); } - /** - * @param array $data - * @return array - */ - private function success($data = []) { + private function success(array $data = []): array { return array_merge($data, ['status' => 'success']); } @@ -205,11 +178,8 @@ class LostController extends Controller { * @PublicPage * @BruteForceProtection(action=passwordResetEmail) * @AnonRateThrottle(limit=10, period=300) - * - * @param string $user - * @return JSONResponse */ - public function email($user) { + public function email(string $user): JSONResponse { if ($this->config->getSystemValue('lost_password_link', '') !== '') { return new JSONResponse($this->error($this->l10n->t('Password reset is disabled'))); } @@ -227,7 +197,7 @@ class LostController extends Controller { // Ignore the error since we do not want to leak this info $this->logger->warning('Could not send password reset email: ' . $e->getMessage()); } catch (\Exception $e) { - $this->logger->logException($e); + $this->logger->error($e->getMessage(), ['exception' => $e]); } $response = new JSONResponse($this->success()); @@ -237,13 +207,8 @@ class LostController extends Controller { /** * @PublicPage - * @param string $token - * @param string $userId - * @param string $password - * @param boolean $proceed - * @return array */ - public function setPassword($token, $userId, $password, $proceed) { + public function setPassword(string $token, string $userId, string $password, bool $proceed): array { if ($this->encryptionManager->isEnabled() && !$proceed) { $encryptionModules = $this->encryptionManager->getEncryptionModules(); foreach ($encryptionModules as $module) { @@ -282,11 +247,10 @@ class LostController extends Controller { } /** - * @param string $input * @throws ResetPasswordException * @throws \OCP\PreConditionNotMetException */ - protected function sendEmail($input) { + protected function sendEmail(string $input): void { $user = $this->findUserByIdOrMail($input); $email = $user->getEMailAddress(); @@ -330,16 +294,14 @@ class LostController extends Controller { $this->mailer->send($message); } catch (\Exception $e) { // Log the exception and continue - $this->logger->logException($e); + $this->logger->error($e->getMessage(), ['app' => 'core', 'exception' => $e]); } } /** - * @param string $input - * @return IUser * @throws ResetPasswordException */ - protected function findUserByIdOrMail($input) { + protected function findUserByIdOrMail(string $input): IUser { $user = $this->userManager->get($input); if ($user instanceof IUser) { if (!$user->isEnabled()) { diff --git a/core/Controller/NavigationController.php b/core/Controller/NavigationController.php index 9d0565145c3..6b994ca33f1 100644 --- a/core/Controller/NavigationController.php +++ b/core/Controller/NavigationController.php @@ -30,12 +30,8 @@ use OCP\IRequest; use OCP\IURLGenerator; class NavigationController extends OCSController { - - /** @var INavigationManager */ - private $navigationManager; - - /** @var IURLGenerator */ - private $urlGenerator; + private INavigationManager $navigationManager; + private IURLGenerator $urlGenerator; public function __construct(string $appName, IRequest $request, INavigationManager $navigationManager, IURLGenerator $urlGenerator) { parent::__construct($appName, $request); @@ -46,9 +42,6 @@ class NavigationController extends OCSController { /** * @NoAdminRequired * @NoCSRFRequired - * - * @param bool $absolute - * @return DataResponse */ public function getAppsNavigation(bool $absolute = false): DataResponse { $navigation = $this->navigationManager->getAll(); @@ -68,9 +61,6 @@ class NavigationController extends OCSController { /** * @NoAdminRequired * @NoCSRFRequired - * - * @param bool $absolute - * @return DataResponse */ public function getSettingsNavigation(bool $absolute = false): DataResponse { $navigation = $this->navigationManager->getAll('settings'); @@ -89,9 +79,6 @@ class NavigationController extends OCSController { /** * Generate an ETag for a list of navigation entries - * - * @param array $navigation - * @return string */ private function generateETag(array $navigation): string { foreach ($navigation as &$nav) { @@ -104,9 +91,6 @@ class NavigationController extends OCSController { /** * Rewrite href attribute of navigation entries to an absolute URL - * - * @param array $navigation - * @return array */ private function rewriteToAbsoluteUrls(array $navigation): array { foreach ($navigation as &$entry) { diff --git a/core/Controller/OCJSController.php b/core/Controller/OCJSController.php index 379b08bf22e..fa13f21607c 100644 --- a/core/Controller/OCJSController.php +++ b/core/Controller/OCJSController.php @@ -45,28 +45,9 @@ use OCP\IUserSession; use OCP\L10N\IFactory; class OCJSController extends Controller { + private JSConfigHelper $helper; - /** @var JSConfigHelper */ - private $helper; - - /** - * OCJSController constructor. - * - * @param string $appName - * @param IRequest $request - * @param IFactory $l10nFactory - * @param Defaults $defaults - * @param IAppManager $appManager - * @param ISession $session - * @param IUserSession $userSession - * @param IConfig $config - * @param IGroupManager $groupManager - * @param IniGetWrapper $iniWrapper - * @param IURLGenerator $urlGenerator - * @param CapabilitiesManager $capabilitiesManager - * @param IInitialStateService $initialStateService - */ - public function __construct($appName, + public function __construct(string $appName, IRequest $request, IFactory $l10nFactory, Defaults $defaults, @@ -100,10 +81,8 @@ class OCJSController extends Controller { * @NoCSRFRequired * @NoTwoFactorRequired * @PublicPage - * - * @return DataDisplayResponse */ - public function getConfig() { + public function getConfig(): DataDisplayResponse { $data = $this->helper->getConfig(); return new DataDisplayResponse($data, Http::STATUS_OK, ['Content-type' => 'text/javascript']); diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index 63a25591ef0..b40776fcfb8 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -35,27 +35,12 @@ use OCP\IUserManager; use OCP\IUserSession; class OCSController extends \OCP\AppFramework\OCSController { + private CapabilitiesManager $capabilitiesManager; + private IUserSession $userSession; + private IUserManager $userManager; + private Manager $keyManager; - /** @var CapabilitiesManager */ - private $capabilitiesManager; - /** @var IUserSession */ - private $userSession; - /** @var IUserManager */ - private $userManager; - /** @var Manager */ - private $keyManager; - - /** - * OCSController constructor. - * - * @param string $appName - * @param IRequest $request - * @param CapabilitiesManager $capabilitiesManager - * @param IUserSession $userSession - * @param IUserManager $userManager - * @param Manager $keyManager - */ - public function __construct($appName, + public function __construct(string $appName, IRequest $request, CapabilitiesManager $capabilitiesManager, IUserSession $userSession, @@ -70,10 +55,8 @@ class OCSController extends \OCP\AppFramework\OCSController { /** * @PublicPage - * - * @return DataResponse */ - public function getConfig() { + public function getConfig(): DataResponse { $data = [ 'version' => '1.7', 'website' => 'Nextcloud', @@ -87,10 +70,8 @@ class OCSController extends \OCP\AppFramework\OCSController { /** * @PublicPage - * - * @return DataResponse */ - public function getCapabilities() { + public function getCapabilities(): DataResponse { $result = []; [$major, $minor, $micro] = \OCP\Util::getVersion(); $result['version'] = [ @@ -116,12 +97,8 @@ class OCSController extends \OCP\AppFramework\OCSController { /** * @PublicPage * @BruteForceProtection(action=login) - * - * @param string $login - * @param string $password - * @return DataResponse */ - public function personCheck($login = '', $password = '') { + public function personCheck(string $login = '', string $password = ''): DataResponse { if ($login !== '' && $password !== '') { if ($this->userManager->checkPassword($login, $password)) { return new DataResponse([ @@ -140,11 +117,8 @@ class OCSController extends \OCP\AppFramework\OCSController { /** * @PublicPage - * - * @param string $cloudId - * @return DataResponse */ - public function getIdentityProof($cloudId) { + public function getIdentityProof(string $cloudId): DataResponse { $userObject = $this->userManager->get($cloudId); if ($userObject !== null) { diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index 30b0a45c13d..85dedd0bf68 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -31,7 +31,6 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\FileDisplayResponse; -use OCP\AppFramework\Utility\ITimeFactory; use OCP\Files\File; use OCP\Files\IRootFolder; use OCP\Files\Node; @@ -40,26 +39,10 @@ use OCP\IPreview; use OCP\IRequest; class PreviewController extends Controller { + private string $userId; + private IRootFolder $root; + private IPreview $preview; - /** @var string */ - private $userId; - - /** @var IRootFolder */ - private $root; - - /** @var IPreview */ - private $preview; - - /** - * PreviewController constructor. - * - * @param string $appName - * @param IRequest $request - * @param IPreview $preview - * @param IRootFolder $root - * @param string $userId - * @param ITimeFactory $timeFactory - */ public function __construct(string $appName, IRequest $request, IPreview $preview, @@ -77,12 +60,6 @@ class PreviewController extends Controller { * @NoAdminRequired * @NoCSRFRequired * - * @param string $file - * @param int $x - * @param int $y - * @param bool $a - * @param bool $forceIcon - * @param string $mode * @return DataResponse|FileDisplayResponse */ public function getPreview( @@ -110,13 +87,6 @@ class PreviewController extends Controller { * @NoAdminRequired * @NoCSRFRequired * - * @param int $fileId - * @param int $x - * @param int $y - * @param bool $a - * @param bool $forceIcon - * @param string $mode - * * @return DataResponse|FileDisplayResponse */ public function getPreviewByFileId( @@ -143,12 +113,6 @@ class PreviewController extends Controller { } /** - * @param Node $node - * @param int $x - * @param int $y - * @param bool $a - * @param bool $forceIcon - * @param string $mode * @return DataResponse|FileDisplayResponse */ private function fetchPreview( diff --git a/core/Controller/ProfileApiController.php b/core/Controller/ProfileApiController.php index d9e20701eaa..a25ebaf846d 100644 --- a/core/Controller/ProfileApiController.php +++ b/core/Controller/ProfileApiController.php @@ -38,18 +38,10 @@ use OCP\IUserSession; use OC\Profile\ProfileManager; class ProfileApiController extends OCSController { - - /** @var ProfileConfigMapper */ - private $configMapper; - - /** @var ProfileManager */ - private $profileManager; - - /** @var IUserManager */ - private $userManager; - - /** @var IUserSession */ - private $userSession; + private ProfileConfigMapper $configMapper; + private ProfileManager $profileManager; + private IUserManager $userManager; + private IUserSession $userSession; public function __construct( IRequest $request, diff --git a/core/Controller/ProfilePageController.php b/core/Controller/ProfilePageController.php index 5a1c8a68e6b..515c1c5a352 100644 --- a/core/Controller/ProfilePageController.php +++ b/core/Controller/ProfilePageController.php @@ -38,24 +38,12 @@ use OCP\Share\IManager as IShareManager; use OCP\UserStatus\IManager as IUserStatusManager; class ProfilePageController extends Controller { - - /** @var IInitialState */ - private $initialStateService; - - /** @var ProfileManager */ - private $profileManager; - - /** @var IShareManager */ - private $shareManager; - - /** @var IUserManager */ - private $userManager; - - /** @var IUserSession */ - private $userSession; - - /** @var IUserStatusManager */ - private $userStatusManager; + private IInitialState $initialStateService; + private ProfileManager $profileManager; + private IShareManager $shareManager; + private IUserManager $userManager; + private IUserSession $userSession; + private IUserStatusManager $userStatusManager; public function __construct( $appName, diff --git a/core/Controller/RecommendedAppsController.php b/core/Controller/RecommendedAppsController.php index b38aaa31fca..5c73f3c5f5e 100644 --- a/core/Controller/RecommendedAppsController.php +++ b/core/Controller/RecommendedAppsController.php @@ -33,11 +33,8 @@ use OCP\IRequest; use OCP\IURLGenerator; class RecommendedAppsController extends Controller { - - /** @var IURLGenerator */ - public $urlGenerator; - /** @var IInitialStateService */ - private $initialStateService; + public IURLGenerator $urlGenerator; + private IInitialStateService $initialStateService; public function __construct(IRequest $request, IURLGenerator $urlGenerator, diff --git a/core/Controller/SearchController.php b/core/Controller/SearchController.php index 95d100a393d..5881ec2db86 100644 --- a/core/Controller/SearchController.php +++ b/core/Controller/SearchController.php @@ -28,23 +28,20 @@ namespace OC\Core\Controller; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; -use OCP\ILogger; use OCP\IRequest; use OCP\ISearch; use OCP\Search\Result; +use Psr\Log\LoggerInterface; class SearchController extends Controller { - - /** @var ISearch */ - private $searcher; - /** @var ILogger */ - private $logger; + private ISearch $searcher; + private LoggerInterface $logger; public function __construct( string $appName, IRequest $request, ISearch $search, - ILogger $logger + LoggerInterface $logger ) { parent::__construct($appName, $request); diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index 620b4f12df7..ab8b1973bf2 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -35,10 +35,8 @@ use OC\Setup; use OCP\ILogger; class SetupController { - /** @var Setup */ - protected $setupHelper; - /** @var string */ - private $autoConfigFile; + protected Setup $setupHelper; + private string $autoConfigFile; /** * @param Setup $setupHelper @@ -48,10 +46,7 @@ class SetupController { $this->setupHelper = $setupHelper; } - /** - * @param $post - */ - public function run($post) { + public function run(array $post): void { // Check for autosetup: $post = $this->loadAutoConfig($post); $opts = $this->setupHelper->getSystemInfo(); @@ -90,7 +85,7 @@ class SetupController { \OC_Template::printGuestPage('', 'installation_forbidden'); } - public function display($post) { + public function display($post): void { $defaults = [ 'adminlogin' => '', 'adminpass' => '', @@ -122,7 +117,7 @@ class SetupController { exit(); } - public function loadAutoConfig($post) { + public function loadAutoConfig(array $post): array { if (file_exists($this->autoConfigFile)) { \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); $AUTOCONFIG = []; diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php index 8f82346c050..deebeb21d32 100644 --- a/core/Controller/TwoFactorChallengeController.php +++ b/core/Controller/TwoFactorChallengeController.php @@ -34,40 +34,21 @@ use OCP\Authentication\TwoFactorAuth\IActivatableAtLogin; use OCP\Authentication\TwoFactorAuth\IProvider; use OCP\Authentication\TwoFactorAuth\IProvidesCustomCSP; use OCP\Authentication\TwoFactorAuth\TwoFactorException; -use OCP\ILogger; use OCP\IRequest; use OCP\ISession; use OCP\IURLGenerator; use OCP\IUserSession; +use Psr\Log\LoggerInterface; class TwoFactorChallengeController extends Controller { + private Manager $twoFactorManager; + private IUserSession $userSession; + private ISession $session; + private LoggerInterface $logger; + private IURLGenerator $urlGenerator; - /** @var Manager */ - private $twoFactorManager; - - /** @var IUserSession */ - private $userSession; - - /** @var ISession */ - private $session; - - /** @var ILogger */ - private $logger; - - /** @var IURLGenerator */ - private $urlGenerator; - - /** - * @param string $appName - * @param IRequest $request - * @param Manager $twoFactorManager - * @param IUserSession $userSession - * @param ISession $session - * @param IURLGenerator $urlGenerator - * @param ILogger $logger - */ public function __construct($appName, IRequest $request, Manager $twoFactorManager, IUserSession $userSession, - ISession $session, IURLGenerator $urlGenerator, ILogger $logger) { + ISession $session, IURLGenerator $urlGenerator, LoggerInterface $logger) { parent::__construct($appName, $request); $this->twoFactorManager = $twoFactorManager; $this->userSession = $userSession; @@ -227,7 +208,7 @@ class TwoFactorChallengeController extends Controller { * @NoAdminRequired * @NoCSRFRequired */ - public function setupProviders() { + public function setupProviders(): StandaloneTemplateResponse { $user = $this->userSession->getUser(); $setupProviders = $this->twoFactorManager->getLoginSetupProviders($user); @@ -236,8 +217,7 @@ class TwoFactorChallengeController extends Controller { 'logout_url' => $this->getLogoutUrl(), ]; - $response = new StandaloneTemplateResponse($this->appName, 'twofactorsetupselection', $data, 'guest'); - return $response; + return new StandaloneTemplateResponse($this->appName, 'twofactorsetupselection', $data, 'guest'); } /** diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php index bfed6d606ae..3290307dc23 100644 --- a/core/Controller/UnifiedSearchController.php +++ b/core/Controller/UnifiedSearchController.php @@ -40,18 +40,10 @@ use OCP\Search\ISearchQuery; use Symfony\Component\Routing\Exception\ResourceNotFoundException; class UnifiedSearchController extends OCSController { - - /** @var SearchComposer */ - private $composer; - - /** @var IUserSession */ - private $userSession; - - /** @var IRouter */ - private $router; - - /** @var IURLGenerator */ - private $urlGenerator; + private SearchComposer $composer; + private IUserSession $userSession; + private IRouter $router; + private IURLGenerator $urlGenerator; public function __construct(IRequest $request, IUserSession $userSession, @@ -71,8 +63,6 @@ class UnifiedSearchController extends OCSController { * @NoCSRFRequired * * @param string $from the url the user is currently at - * - * @return DataResponse */ public function getProviders(string $from = ''): DataResponse { [$route, $parameters] = $this->getRouteInformation($from); diff --git a/core/Controller/UserController.php b/core/Controller/UserController.php index 6d50348c2a5..b9946dfaec6 100644 --- a/core/Controller/UserController.php +++ b/core/Controller/UserController.php @@ -30,10 +30,7 @@ use OCP\IRequest; use OCP\IUserManager; class UserController extends Controller { - /** - * @var IUserManager - */ - protected $userManager; + protected IUserManager $userManager; public function __construct($appName, IRequest $request, diff --git a/core/Controller/WalledGardenController.php b/core/Controller/WalledGardenController.php index 4aff72beb44..584c264aaf9 100644 --- a/core/Controller/WalledGardenController.php +++ b/core/Controller/WalledGardenController.php @@ -32,10 +32,8 @@ class WalledGardenController extends Controller { /** * @PublicPage * @NoCSRFRequired - * - * @return Response */ - public function get() { + public function get(): Response { $resp = new Response(); $resp->setStatus(Http::STATUS_NO_CONTENT); return $resp; diff --git a/core/Controller/WebAuthnController.php b/core/Controller/WebAuthnController.php index 1aab505f16a..1eab5c79be6 100644 --- a/core/Controller/WebAuthnController.php +++ b/core/Controller/WebAuthnController.php @@ -32,29 +32,22 @@ use OC\Authentication\WebAuthn\Manager; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\JSONResponse; -use OCP\ILogger; use OCP\IRequest; use OCP\ISession; use OCP\Util; +use Psr\Log\LoggerInterface; use Webauthn\PublicKeyCredentialRequestOptions; class WebAuthnController extends Controller { private const WEBAUTHN_LOGIN = 'webauthn_login'; private const WEBAUTHN_LOGIN_UID = 'webauthn_login_uid'; - /** @var Manager */ - private $webAuthnManger; + private Manager $webAuthnManger; + private ISession $session; + private LoggerInterface $logger; + private WebAuthnChain $webAuthnChain; - /** @var ISession */ - private $session; - - /** @var ILogger */ - private $logger; - - /** @var WebAuthnChain */ - private $webAuthnChain; - - public function __construct($appName, IRequest $request, Manager $webAuthnManger, ISession $session, ILogger $logger, WebAuthnChain $webAuthnChain) { + public function __construct($appName, IRequest $request, Manager $webAuthnManger, ISession $session, LoggerInterface $logger, WebAuthnChain $webAuthnChain) { parent::__construct($appName, $request); $this->webAuthnManger = $webAuthnManger; diff --git a/core/Service/LoginFlowV2Service.php b/core/Service/LoginFlowV2Service.php index 8710cab5cae..bafee462456 100644 --- a/core/Service/LoginFlowV2Service.php +++ b/core/Service/LoginFlowV2Service.php @@ -38,33 +38,25 @@ use OC\Core\Exception\LoginFlowV2NotFoundException; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; -use OCP\ILogger; use OCP\Security\ICrypto; use OCP\Security\ISecureRandom; +use Psr\Log\LoggerInterface; class LoginFlowV2Service { - - /** @var LoginFlowV2Mapper */ - private $mapper; - /** @var ISecureRandom */ - private $random; - /** @var ITimeFactory */ - private $time; - /** @var IConfig */ - private $config; - /** @var ICrypto */ - private $crypto; - /** @var ILogger */ - private $logger; - /** @var IProvider */ - private $tokenProvider; + private LoginFlowV2Mapper $mapper; + private ISecureRandom $random; + private ITimeFactory $time; + private IConfig $config; + private ICrypto $crypto; + private LoggerInterface $logger; + private IProvider $tokenProvider; public function __construct(LoginFlowV2Mapper $mapper, ISecureRandom $random, ITimeFactory $time, IConfig $config, ICrypto $crypto, - ILogger $logger, + LoggerInterface $logger, IProvider $tokenProvider) { $this->mapper = $mapper; $this->random = $random; diff --git a/core/register_command.php b/core/register_command.php index 764a51b7e8a..de04fedf30d 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -77,7 +77,7 @@ if (\OC::$server->getConfig()->getSystemValue('installed', false)) { $application->add(new OC\Core\Command\App\Install()); $application->add(new OC\Core\Command\App\GetPath()); $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager())); - $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->getLogger())); + $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->get(LoggerInterface::class))); $application->add(\OC::$server->query(\OC\Core\Command\App\Update::class)); $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class)); |