Skip to content

Commit 1164c76

Browse files
authored
Merge pull request #31948 from nextcloud/core-cleanup-74
Update core to PHP 7.4 standard
2 parents e86bcc8 + b70c6a1 commit 1164c76

131 files changed

Lines changed: 470 additions & 1363 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,19 @@
2828

2929
use OC\BackgroundJob\QueuedJob;
3030
use OCP\IConfig;
31-
use OCP\ILogger;
31+
use Psr\Log\LoggerInterface;
3232

3333
class BackgroundCleanupUpdaterBackupsJob extends QueuedJob {
34+
protected IConfig $config;
35+
protected LoggerInterface $log;
3436

35-
/** @var IConfig */
36-
protected $config;
37-
/** @var ILogger */
38-
protected $log;
39-
40-
public function __construct(IConfig $config, ILogger $log) {
37+
public function __construct(IConfig $config, LoggerInterface $log) {
4138
$this->config = $config;
4239
$this->log = $log;
4340
}
4441

4542
/**
4643
* This job cleans up all backups except the latest 3 from the updaters backup directory
47-
*
4844
*/
4945
public function run($arguments) {
5046
$dataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');

core/BackgroundJobs/CheckForUserCertificates.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,9 @@
3535
use OCP\IUserManager;
3636

3737
class CheckForUserCertificates extends QueuedJob {
38-
39-
/** @var IConfig */
40-
protected $config;
41-
/** @var IUserManager */
42-
private $userManager;
43-
/** @var IRootFolder */
44-
private $rootFolder;
38+
protected IConfig $config;
39+
private IUserManager $userManager;
40+
private IRootFolder $rootFolder;
4541

4642
public function __construct(IConfig $config, IUserManager $userManager, IRootFolder $rootFolder) {
4743
$this->config = $config;

core/BackgroundJobs/CleanupLoginFlowV2.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
use OCP\BackgroundJob\TimedJob;
3232

3333
class CleanupLoginFlowV2 extends TimedJob {
34-
35-
/** @var LoginFlowV2Mapper */
36-
private $loginFlowV2Mapper;
34+
private LoginFlowV2Mapper $loginFlowV2Mapper;
3735

3836
public function __construct(ITimeFactory $time, LoginFlowV2Mapper $loginFlowV2Mapper) {
3937
parent::__construct($time);

core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@
3131
use OCP\IUserManager;
3232

3333
class LookupServerSendCheckBackgroundJob extends QueuedJob {
34-
35-
/** @var IConfig */
36-
protected $config;
37-
/** @var IUserManager */
38-
private $userManager;
34+
protected IConfig $config;
35+
private IUserManager $userManager;
3936

4037
public function __construct(IConfig $config, IUserManager $userManager) {
4138
$this->config = $config;

core/Command/App/Disable.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,9 @@
3333
use Symfony\Component\Console\Output\OutputInterface;
3434

3535
class Disable extends Command implements CompletionAwareInterface {
36+
protected IAppManager $appManager;
37+
protected int $exitCode = 0;
3638

37-
/** @var IAppManager */
38-
protected $appManager;
39-
40-
/** @var int */
41-
protected $exitCode = 0;
42-
43-
/**
44-
* @param IAppManager $appManager
45-
*/
4639
public function __construct(IAppManager $appManager) {
4740
parent::__construct();
4841
$this->appManager = $appManager;

core/Command/App/Enable.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,10 @@
3939
use Symfony\Component\Console\Output\OutputInterface;
4040

4141
class Enable extends Command implements CompletionAwareInterface {
42+
protected IAppManager $appManager;
43+
protected IGroupManager $groupManager;
44+
protected int $exitCode = 0;
4245

43-
/** @var IAppManager */
44-
protected $appManager;
45-
46-
/** @var IGroupManager */
47-
protected $groupManager;
48-
49-
/** @var int */
50-
protected $exitCode = 0;
51-
52-
/**
53-
* @param IAppManager $appManager
54-
* @param IGroupManager $groupManager
55-
*/
5646
public function __construct(IAppManager $appManager, IGroupManager $groupManager) {
5747
parent::__construct();
5848
$this->appManager = $appManager;

core/Command/App/ListApps.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,8 @@
3333
use Symfony\Component\Console\Output\OutputInterface;
3434

3535
class ListApps extends Base {
36+
protected IAppManager $manager;
3637

37-
/** @var IAppManager */
38-
protected $manager;
39-
40-
/**
41-
* @param IAppManager $manager
42-
*/
4338
public function __construct(IAppManager $manager) {
4439
parent::__construct();
4540
$this->manager = $manager;

core/Command/App/Remove.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
use OC\Installer;
3030
use OCP\App\IAppManager;
31-
use OCP\ILogger;
31+
use Psr\Log\LoggerInterface;
3232
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
3333
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
3434
use Symfony\Component\Console\Command\Command;
@@ -39,20 +39,11 @@
3939
use Throwable;
4040

4141
class Remove extends Command implements CompletionAwareInterface {
42+
protected IAppManager $manager;
43+
private Installer $installer;
44+
private LoggerInterface $logger;
4245

43-
/** @var IAppManager */
44-
protected $manager;
45-
/** @var Installer */
46-
private $installer;
47-
/** @var ILogger */
48-
private $logger;
49-
50-
/**
51-
* @param IAppManager $manager
52-
* @param Installer $installer
53-
* @param ILogger $logger
54-
*/
55-
public function __construct(IAppManager $manager, Installer $installer, ILogger $logger) {
46+
public function __construct(IAppManager $manager, Installer $installer, LoggerInterface $logger) {
5647
parent::__construct();
5748
$this->manager = $manager;
5849
$this->installer = $installer;
@@ -100,9 +91,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
10091
$output->writeln($appId . ' disabled');
10192
} catch (Throwable $e) {
10293
$output->writeln('<error>Error: ' . $e->getMessage() . '</error>');
103-
$this->logger->logException($e, [
94+
$this->logger->error($e->getMessage(), [
10495
'app' => 'CLI',
105-
'level' => ILogger::ERROR
96+
'exception' => $e,
10697
]);
10798
return 1;
10899
}
@@ -113,9 +104,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
113104
$result = $this->installer->removeApp($appId);
114105
} catch (Throwable $e) {
115106
$output->writeln('<error>Error: ' . $e->getMessage() . '</error>');
116-
$this->logger->logException($e, [
107+
$this->logger->error($e->getMessage(), [
117108
'app' => 'CLI',
118-
'level' => ILogger::ERROR
109+
'exception' => $e,
119110
]);
120111
return 1;
121112
}

core/Command/App/Update.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,19 @@
2929

3030
use OC\Installer;
3131
use OCP\App\IAppManager;
32-
use OCP\ILogger;
32+
use Psr\Log\LoggerInterface;
3333
use Symfony\Component\Console\Command\Command;
3434
use Symfony\Component\Console\Input\InputArgument;
3535
use Symfony\Component\Console\Input\InputInterface;
3636
use Symfony\Component\Console\Input\InputOption;
3737
use Symfony\Component\Console\Output\OutputInterface;
3838

3939
class Update extends Command {
40+
protected IAppManager $manager;
41+
private Installer $installer;
42+
private LoggerInterface $logger;
4043

41-
/** @var IAppManager */
42-
protected $manager;
43-
/** @var Installer */
44-
private $installer;
45-
/** @var ILogger */
46-
private $logger;
47-
48-
/**
49-
* @param IAppManager $manager
50-
* @param Installer $installer
51-
*/
52-
public function __construct(IAppManager $manager, Installer $installer, ILogger $logger) {
44+
public function __construct(IAppManager $manager, Installer $installer, LoggerInterface $logger) {
5345
parent::__construct();
5446
$this->manager = $manager;
5547
$this->installer = $installer;
@@ -114,7 +106,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
114106
try {
115107
$result = $this->installer->updateAppstoreApp($appId, $input->getOption('allow-unstable'));
116108
} catch (\Exception $e) {
117-
$this->logger->logException($e, ['message' => 'Failure during update of app "' . $appId . '"','app' => 'app:update']);
109+
$this->logger->error('Failure during update of app "' . $appId . '"', [
110+
'app' => 'app:update',
111+
'exception' => $e,
112+
]);
118113
$output->writeln('Error: ' . $e->getMessage());
119114
$return = 1;
120115
}

core/Command/Background/Base.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,8 @@
3838
*/
3939
abstract class Base extends Command {
4040
abstract protected function getMode();
41+
protected IConfig $config;
4142

42-
/**
43-
* @var \OCP\IConfig
44-
*/
45-
protected $config;
46-
47-
/**
48-
* @param \OCP\IConfig $config
49-
*/
5043
public function __construct(IConfig $config) {
5144
parent::__construct();
5245
$this->config = $config;

0 commit comments

Comments
 (0)