Uses PHP8's constructor property promotion in core/Command/Maintenance classes.

Signed-off-by: Faraz Samapoor <fsa@adlas.at>
This commit is contained in:
Faraz Samapoor 2023-06-12 18:16:44 +03:30 committed by Louis
parent ceee417d2c
commit ec63264153
8 changed files with 21 additions and 51 deletions

View file

@ -29,13 +29,10 @@ use Symfony\Component\Console\Input\InputInterface;
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();
}

View file

@ -47,13 +47,11 @@ use Throwable;
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() {

View file

@ -35,16 +35,11 @@ use Symfony\Component\Console\Output\OutputInterface;
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() {

View file

@ -31,13 +31,8 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class UpdateJS extends Command {
protected IMimeTypeDetector $mimetypeDetector;
public function __construct(
IMimeTypeDetector $mimetypeDetector
) {
public function __construct(protected IMimeTypeDetector $mimetypeDetector) {
parent::__construct();
$this->mimetypeDetector = $mimetypeDetector;
}
protected function configure() {

View file

@ -33,10 +33,7 @@ use Symfony\Component\Console\Input\InputOption;
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();
}

View file

@ -47,19 +47,16 @@ use Symfony\Component\Console\Input\InputOption;
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();
}

View file

@ -38,15 +38,10 @@ use Symfony\Component\Console\Output\OutputInterface;
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();
}

View file

@ -33,15 +33,11 @@ use Symfony\Component\Console\Input\InputInterface;
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() {