Uses PHP8's constructor property promotion in core/Command/Config and core/Command/Group classes.

Signed-off-by: Faraz Samapoor <fsa@adlas.at>
pull/38768/head
Faraz Samapoor 2023-06-12 18:22:05 +07:00 committed by Louis
parent 64c19ce3aa
commit 3519689d50
12 changed files with 21 additions and 55 deletions

@ -28,14 +28,8 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class DeleteConfig extends Base {
protected IConfig $config;
/**
* @param IConfig $config
*/
public function __construct(IConfig $config) {
public function __construct(protected IConfig $config) {
parent::__construct();
$this->config = $config;
}
protected function configure() {

@ -28,11 +28,8 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class GetConfig extends Base {
protected IConfig $config;
public function __construct(IConfig $config) {
public function __construct(protected IConfig $config) {
parent::__construct();
$this->config = $config;
}
protected function configure() {

@ -28,11 +28,8 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class SetConfig extends Base {
protected IConfig $config;
public function __construct(IConfig $config) {
public function __construct(protected IConfig $config) {
parent::__construct();
$this->config = $config;
}
protected function configure() {

@ -35,11 +35,9 @@ use Symfony\Component\Console\Output\OutputInterface;
class Import extends Command implements CompletionAwareInterface {
protected array $validRootKeys = ['system', 'apps'];
protected IConfig $config;
public function __construct(IConfig $config) {
public function __construct(protected IConfig $config) {
parent::__construct();
$this->config = $config;
}
protected function configure() {

@ -33,13 +33,12 @@ use Symfony\Component\Console\Output\OutputInterface;
class ListConfigs extends Base {
protected string $defaultOutputFormat = self::OUTPUT_FORMAT_JSON_PRETTY;
protected SystemConfig $systemConfig;
protected IAppConfig $appConfig;
public function __construct(SystemConfig $systemConfig, IAppConfig $appConfig) {
public function __construct(
protected SystemConfig $systemConfig,
protected IAppConfig $appConfig,
) {
parent::__construct();
$this->systemConfig = $systemConfig;
$this->appConfig = $appConfig;
}
protected function configure() {

@ -26,11 +26,8 @@ use OC\SystemConfig;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
abstract class Base extends \OC\Core\Command\Base {
protected SystemConfig $systemConfig;
public function __construct(SystemConfig $systemConfig) {
public function __construct(protected SystemConfig $systemConfig) {
parent::__construct();
$this->systemConfig = $systemConfig;
}
/**

@ -36,10 +36,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Add extends Base {
protected IGroupManager $groupManager;
public function __construct(IGroupManager $groupManager) {
$this->groupManager = $groupManager;
public function __construct(protected IGroupManager $groupManager) {
parent::__construct();
}

@ -34,12 +34,10 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class AddUser extends Base {
protected IUserManager $userManager;
protected IGroupManager $groupManager;
public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
$this->userManager = $userManager;
$this->groupManager = $groupManager;
public function __construct(
protected IUserManager $userManager,
protected IGroupManager $groupManager,
) {
parent::__construct();
}

@ -35,10 +35,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Delete extends Base {
protected IGroupManager $groupManager;
public function __construct(IGroupManager $groupManager) {
$this->groupManager = $groupManager;
public function __construct(protected IGroupManager $groupManager) {
parent::__construct();
}

@ -35,10 +35,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Info extends Base {
protected IGroupManager $groupManager;
public function __construct(IGroupManager $groupManager) {
$this->groupManager = $groupManager;
public function __construct(protected IGroupManager $groupManager) {
parent::__construct();
}

@ -32,10 +32,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class ListCommand extends Base {
protected IGroupManager $groupManager;
public function __construct(IGroupManager $groupManager) {
$this->groupManager = $groupManager;
public function __construct(protected IGroupManager $groupManager) {
parent::__construct();
}

@ -34,12 +34,10 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class RemoveUser extends Base {
protected IUserManager $userManager;
protected IGroupManager $groupManager;
public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
$this->userManager = $userManager;
$this->groupManager = $groupManager;
public function __construct(
protected IUserManager $userManager,
protected IGroupManager $groupManager,
) {
parent::__construct();
}