Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses PHP8's constructor property promotion in core/Command/Config and Group #38768

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions core/Command/Config/App/DeleteConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@
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() {
Expand Down
7 changes: 3 additions & 4 deletions core/Command/Config/App/GetConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@
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() {
Expand Down
7 changes: 3 additions & 4 deletions core/Command/Config/App/SetConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@
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() {
Expand Down
6 changes: 3 additions & 3 deletions core/Command/Config/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@

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() {
Expand Down
9 changes: 4 additions & 5 deletions core/Command/Config/ListConfigs.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@

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() {
Expand Down
7 changes: 3 additions & 4 deletions core/Command/Config/System/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@
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;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion core/Command/Config/System/DeleteConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
use Symfony\Component\Console\Output\OutputInterface;

class DeleteConfig extends Base {
public function __construct(SystemConfig $systemConfig) {
public function __construct(
SystemConfig $systemConfig,
) {
parent::__construct($systemConfig);
}

Expand Down
4 changes: 3 additions & 1 deletion core/Command/Config/System/GetConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
use Symfony\Component\Console\Output\OutputInterface;

class GetConfig extends Base {
public function __construct(SystemConfig $systemConfig) {
public function __construct(
SystemConfig $systemConfig,
) {
parent::__construct($systemConfig);
}

Expand Down
4 changes: 3 additions & 1 deletion core/Command/Config/System/SetConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
use Symfony\Component\Console\Output\OutputInterface;

class SetConfig extends Base {
public function __construct(SystemConfig $systemConfig) {
public function __construct(
SystemConfig $systemConfig,
) {
parent::__construct($systemConfig);
}

Expand Down
7 changes: 3 additions & 4 deletions core/Command/Group/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@
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();
}

Expand Down
10 changes: 4 additions & 6 deletions core/Command/Group/AddUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@
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();
}

Expand Down
7 changes: 3 additions & 4 deletions core/Command/Group/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@
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();
}

Expand Down
7 changes: 3 additions & 4 deletions core/Command/Group/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@
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();
}

Expand Down
7 changes: 3 additions & 4 deletions core/Command/Group/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@
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();
}

Expand Down
10 changes: 4 additions & 6 deletions core/Command/Group/RemoveUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@
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();
}

Expand Down