Skip to content

Commit

Permalink
Merge pull request #38767 from fsamapoor/constructor_property_promoti…
Browse files Browse the repository at this point in the history
…on_in_core_command_part4

Uses PHP8's constructor property promotion in core/Command/Maintenance
  • Loading branch information
artonge authored Jun 19, 2023
2 parents 98ea74b + d60bedf commit 81bb336
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 49 deletions.
11 changes: 4 additions & 7 deletions core/Command/Maintenance/DataFingerprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,10 @@
use Symfony\Component\Console\Output\OutputInterface;

class DataFingerprint extends Command {
protected IConfig $config;
protected ITimeFactory $timeFactory;

public function __construct(IConfig $config,
ITimeFactory $timeFactory) {
$this->config = $config;
$this->timeFactory = $timeFactory;
public function __construct(
protected IConfig $config,
protected ITimeFactory $timeFactory,
) {
parent::__construct();
}

Expand Down
10 changes: 4 additions & 6 deletions core/Command/Maintenance/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@
use function get_class;

class Install extends Command {
private SystemConfig $config;
private IniGetWrapper $iniGetWrapper;

public function __construct(SystemConfig $config, IniGetWrapper $iniGetWrapper) {
public function __construct(
private SystemConfig $config,
private IniGetWrapper $iniGetWrapper,
) {
parent::__construct();
$this->config = $config;
$this->iniGetWrapper = $iniGetWrapper;
}

protected function configure() {
Expand Down
9 changes: 2 additions & 7 deletions core/Command/Maintenance/Mimetype/UpdateDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,11 @@
class UpdateDB extends Command {
public const DEFAULT_MIMETYPE = 'application/octet-stream';

protected IMimeTypeDetector $mimetypeDetector;
protected IMimeTypeLoader $mimetypeLoader;

public function __construct(
IMimeTypeDetector $mimetypeDetector,
IMimeTypeLoader $mimetypeLoader
protected IMimeTypeDetector $mimetypeDetector,
protected IMimeTypeLoader $mimetypeLoader,
) {
parent::__construct();
$this->mimetypeDetector = $mimetypeDetector;
$this->mimetypeLoader = $mimetypeLoader;
}

protected function configure() {
Expand Down
5 changes: 1 addition & 4 deletions core/Command/Maintenance/Mimetype/UpdateJS.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,10 @@
use Symfony\Component\Console\Output\OutputInterface;

class UpdateJS extends Command {
protected IMimeTypeDetector $mimetypeDetector;

public function __construct(
IMimeTypeDetector $mimetypeDetector
protected IMimeTypeDetector $mimetypeDetector,
) {
parent::__construct();
$this->mimetypeDetector = $mimetypeDetector;
}

protected function configure() {
Expand Down
7 changes: 3 additions & 4 deletions core/Command/Maintenance/Mode.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
use Symfony\Component\Console\Output\OutputInterface;

class Mode extends Command {
protected IConfig $config;

public function __construct(IConfig $config) {
$this->config = $config;
public function __construct(
protected IConfig $config,
) {
parent::__construct();
}

Expand Down
15 changes: 6 additions & 9 deletions core/Command/Maintenance/Repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,16 @@
use Symfony\Component\Console\Output\OutputInterface;

class Repair extends Command {
protected \OC\Repair $repair;
protected IConfig $config;
private IEventDispatcher $dispatcher;
private ProgressBar $progress;
private OutputInterface $output;
private IAppManager $appManager;
protected bool $errored = false;

public function __construct(\OC\Repair $repair, IConfig $config, IEventDispatcher $dispatcher, IAppManager $appManager) {
$this->repair = $repair;
$this->config = $config;
$this->dispatcher = $dispatcher;
$this->appManager = $appManager;
public function __construct(
protected \OC\Repair $repair,
protected IConfig $config,
private IEventDispatcher $dispatcher,
private IAppManager $appManager,
) {
parent::__construct();
}

Expand Down
9 changes: 2 additions & 7 deletions core/Command/Maintenance/RepairShareOwnership.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,10 @@
use Symfony\Component\Console\Question\ConfirmationQuestion;

class RepairShareOwnership extends Command {
private IDBConnection $dbConnection;
private IUserManager $userManager;

public function __construct(
IDBConnection $dbConnection,
IUserManager $userManager
private IDBConnection $dbConnection,
private IUserManager $userManager,
) {
$this->dbConnection = $dbConnection;
$this->userManager = $userManager;
parent::__construct();
}

Expand Down
6 changes: 1 addition & 5 deletions core/Command/Maintenance/UpdateTheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,11 @@
use Symfony\Component\Console\Output\OutputInterface;

class UpdateTheme extends UpdateJS {
protected IMimeTypeDetector $mimetypeDetector;
protected ICacheFactory $cacheFactory;

public function __construct(
IMimeTypeDetector $mimetypeDetector,
ICacheFactory $cacheFactory
protected ICacheFactory $cacheFactory,
) {
parent::__construct($mimetypeDetector);
$this->cacheFactory = $cacheFactory;
}

protected function configure() {
Expand Down

0 comments on commit 81bb336

Please sign in to comment.