Skip to content

Commit 0e5d4df

Browse files
committed
chore(php8): rector common-bundle
Applied rules: * ClassPropertyAssignToConstructorPromotionRector (https://wiki.php.net/rfc/constructor_promotion php/php-src#5291) * StrStartsWithRector (https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions) * StrContainsRector (https://externals.io/message/108562 php/php-src#5179) * ReadOnlyPropertyRector (https://wiki.php.net/rfc/readonly_properties_v2)
1 parent c878375 commit 0e5d4df

File tree

108 files changed

+269
-694
lines changed

Some content is hidden

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

108 files changed

+269
-694
lines changed

EMS/common-bundle/src/Command/Admin/CreateCommand.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,16 @@
1515

1616
class CreateCommand extends AbstractCommand
1717
{
18-
public const CONFIG_TYPE = 'config-type';
19-
public const JSON_PATH = 'json-path';
20-
public const FOLDER = 'folder';
18+
final public const CONFIG_TYPE = 'config-type';
19+
final public const JSON_PATH = 'json-path';
20+
final public const FOLDER = 'folder';
2121
private string $configType;
2222
private string $jsonPath;
23-
private AdminHelper $adminHelper;
2423
private string $folder;
2524

26-
public function __construct(AdminHelper $adminHelper, string $projectFolder)
25+
public function __construct(private readonly AdminHelper $adminHelper, string $projectFolder)
2726
{
2827
parent::__construct();
29-
$this->adminHelper = $adminHelper;
3028
$this->folder = $projectFolder.DIRECTORY_SEPARATOR.ConfigHelper::DEFAULT_FOLDER;
3129
}
3230

EMS/common-bundle/src/Command/Admin/DeleteCommand.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@
1212

1313
class DeleteCommand extends AbstractCommand
1414
{
15-
public const CONFIG_TYPE = 'config-type';
16-
public const ENTITY_NAME = 'entity-name';
15+
final public const CONFIG_TYPE = 'config-type';
16+
final public const ENTITY_NAME = 'entity-name';
1717
private string $configType;
1818
private string $entityName;
19-
private AdminHelper $adminHelper;
2019

21-
public function __construct(AdminHelper $adminHelper)
20+
public function __construct(private readonly AdminHelper $adminHelper)
2221
{
2322
parent::__construct();
24-
$this->adminHelper = $adminHelper;
2523
}
2624

2725
public function initialize(InputInterface $input, OutputInterface $output): void

EMS/common-bundle/src/Command/Admin/GetCommand.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,17 @@
1515

1616
class GetCommand extends AbstractCommand
1717
{
18-
public const CONFIG_TYPE = 'config-type';
19-
public const EXPORT = 'export';
20-
public const FOLDER = 'folder';
21-
private AdminHelper $adminHelper;
18+
final public const CONFIG_TYPE = 'config-type';
19+
final public const EXPORT = 'export';
20+
final public const FOLDER = 'folder';
2221
private string $configType;
2322
private bool $export;
2423
private string $folder;
2524
private CoreApiInterface $coreApi;
2625

27-
public function __construct(AdminHelper $adminHelper, string $projectFolder)
26+
public function __construct(private readonly AdminHelper $adminHelper, string $projectFolder)
2827
{
2928
parent::__construct();
30-
$this->adminHelper = $adminHelper;
3129
$this->folder = $projectFolder.DIRECTORY_SEPARATOR.ConfigHelper::DEFAULT_FOLDER;
3230
}
3331

EMS/common-bundle/src/Command/Admin/JobCommand.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@
1515

1616
class JobCommand extends AbstractCommand
1717
{
18-
public const JOB_ID = 'job-id';
19-
private AdminHelper $adminHelper;
18+
final public const JOB_ID = 'job-id';
2019
private CoreApiInterface $coreApi;
2120
private string $jobIdOrJsonFile;
22-
private string $folder;
21+
private readonly string $folder;
2322

24-
public function __construct(AdminHelper $adminHelper, string $projectFolder)
23+
public function __construct(private readonly AdminHelper $adminHelper, string $projectFolder)
2524
{
2625
parent::__construct();
27-
$this->adminHelper = $adminHelper;
2826
$this->folder = $projectFolder.DIRECTORY_SEPARATOR.ConfigHelper::DEFAULT_FOLDER;
2927
}
3028

EMS/common-bundle/src/Command/Admin/LoginCommand.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@ class LoginCommand extends AbstractCommand
1818
private const ARG_BASE_URL = 'base-url';
1919
private const OPTION_USERNAME = 'username';
2020
private const OPTION_PASSWORD = 'password';
21-
private AdminHelper $adminHelper;
22-
private ?string $backendUrl;
2321

24-
public function __construct(AdminHelper $adminHelper, ?string $backendUrl)
22+
public function __construct(private readonly AdminHelper $adminHelper, private ?string $backendUrl)
2523
{
2624
parent::__construct();
27-
$this->adminHelper = $adminHelper;
28-
$this->backendUrl = $backendUrl;
2925
}
3026

3127
protected function configure(): void

EMS/common-bundle/src/Command/Admin/UpdateCommand.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,18 @@
1515

1616
class UpdateCommand extends AbstractCommand
1717
{
18-
public const CONFIG_TYPE = 'config-type';
19-
public const ENTITY_NAME = 'entity-name';
20-
public const JSON_PATH = 'json-path';
21-
public const FOLDER = 'folder';
18+
final public const CONFIG_TYPE = 'config-type';
19+
final public const ENTITY_NAME = 'entity-name';
20+
final public const JSON_PATH = 'json-path';
21+
final public const FOLDER = 'folder';
2222
private string $configType;
2323
private string $entityName;
2424
private ?string $jsonPath = null;
25-
private AdminHelper $adminHelper;
2625
private string $folder;
2726

28-
public function __construct(AdminHelper $adminHelper, string $projectFolder)
27+
public function __construct(private readonly AdminHelper $adminHelper, string $projectFolder)
2928
{
3029
parent::__construct();
31-
$this->adminHelper = $adminHelper;
3230
$this->folder = $projectFolder.DIRECTORY_SEPARATOR.ConfigHelper::DEFAULT_FOLDER;
3331
}
3432

EMS/common-bundle/src/Command/ClearLogsCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@
1414
class ClearLogsCommand extends AbstractCommand
1515
{
1616
protected static $defaultName = Commands::CLEAR_LOGS;
17-
private LogRepository $logRepository;
1817
private \DateTime $before;
1918
/** @var string[] */
2019
private array $channels = [];
2120

2221
private const OPTION_BEFORE = 'before';
2322
private const OPTION_CHANNEL = 'channel';
2423

25-
public function __construct(LogRepository $logRepository)
24+
public function __construct(private readonly LogRepository $logRepository)
2625
{
2726
parent::__construct();
28-
$this->logRepository = $logRepository;
2927
}
3028

3129
protected function configure(): void

EMS/common-bundle/src/Command/CurlCommand.php

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,23 @@
2626

2727
class CurlCommand extends AbstractCommand
2828
{
29-
public const ARGUMENT_URL = 'url';
30-
public const ARGUMENT_FILENAME = 'filename';
31-
public const OPTION_METHOD = 'method';
32-
public const OPTION_BASE_URL = 'base-url';
33-
public const OPTION_SAVE = 'save';
29+
final public const ARGUMENT_URL = 'url';
30+
final public const ARGUMENT_FILENAME = 'filename';
31+
final public const OPTION_METHOD = 'method';
32+
final public const OPTION_BASE_URL = 'base-url';
33+
final public const OPTION_SAVE = 'save';
3434
protected static $defaultName = Commands::CURL;
35-
private EventDispatcherInterface $eventDispatcher;
36-
private ControllerResolverInterface $controllerResolver;
37-
private AssetRuntime $assetRuntime;
3835
private ?SessionInterface $session = null;
39-
private RequestStack $requestStack;
40-
private StorageManager $storageManager;
4136

4237
private string $url;
4338
private string $method;
4439
private string $filename;
4540
private ?string $baseUrl = null;
4641
private bool $save;
4742

48-
public function __construct(EventDispatcherInterface $eventDispatcher, ControllerResolverInterface $controllerResolver, RequestStack $requestStack, StorageManager $storageManager, AssetRuntime $assetRuntime)
43+
public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly ControllerResolverInterface $controllerResolver, private readonly RequestStack $requestStack, private readonly StorageManager $storageManager, private readonly AssetRuntime $assetRuntime)
4944
{
5045
parent::__construct();
51-
$this->eventDispatcher = $eventDispatcher;
52-
$this->controllerResolver = $controllerResolver;
53-
$this->requestStack = $requestStack;
54-
$this->storageManager = $storageManager;
55-
$this->assetRuntime = $assetRuntime;
5646
}
5747

5848
protected function configure(): void
@@ -81,20 +71,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8171
$this->io->writeln(\sprintf('The file %s has been generated', $this->filename));
8272

8373
if (!$this->save && null === $this->baseUrl) {
84-
return parent::EXECUTE_SUCCESS;
74+
return self::EXECUTE_SUCCESS;
8575
}
8676

8777
$hash = $this->storageManager->saveFile($this->filename, StorageInterface::STORAGE_USAGE_ASSET);
8878
$this->io->writeln(\sprintf('The file has been saved with the id %s', $hash));
8979

9080
if (null === $this->baseUrl) {
91-
return parent::EXECUTE_SUCCESS;
81+
return self::EXECUTE_SUCCESS;
9282
}
9383

9484
$url = $this->getUrl($hash);
9585
$this->io->writeln(\sprintf('The file is available at %s', $url));
9686

97-
return parent::EXECUTE_SUCCESS;
87+
return self::EXECUTE_SUCCESS;
9888
}
9989

10090
protected function performRequest(): void

EMS/common-bundle/src/Command/Document/DownloadCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ class DownloadCommand extends AbstractCommand
1818
private const CONTENT_TYPE = 'content-type';
1919
private const FOLDER = 'folder';
2020
private const DEFAULT_FOLDER = 'document';
21-
private AdminHelper $adminHelper;
2221
private string $contentType;
2322
private string $folder;
2423

25-
public function __construct(AdminHelper $adminHelper, string $projectFolder)
24+
public function __construct(private readonly AdminHelper $adminHelper, string $projectFolder)
2625
{
2726
parent::__construct();
28-
$this->adminHelper = $adminHelper;
2927
$this->folder = $projectFolder.DIRECTORY_SEPARATOR.self::DEFAULT_FOLDER;
3028
}
3129

EMS/common-bundle/src/Command/Document/UpdateCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ class UpdateCommand extends AbstractCommand
1919
private const CONTENT_TYPE = 'content-type';
2020
private const FOLDER = 'folder';
2121
private const DEFAULT_FOLDER = 'document';
22-
private AdminHelper $adminHelper;
2322
private string $contentType;
2423
private string $folder;
2524

26-
public function __construct(AdminHelper $adminHelper, string $projectFolder)
25+
public function __construct(private readonly AdminHelper $adminHelper, string $projectFolder)
2726
{
2827
parent::__construct();
29-
$this->adminHelper = $adminHelper;
3028
$this->folder = $projectFolder.DIRECTORY_SEPARATOR.self::DEFAULT_FOLDER;
3129
}
3230

0 commit comments

Comments
 (0)