Skip to content

Commit bc12e35

Browse files
Merge pull request #169 from magento-commerce/MCLOUD-13145
Add support for PHP 8.4 to ece-tools
2 parents 5356cb7 + c15a604 commit bc12e35

File tree

122 files changed

+2049
-1070
lines changed

Some content is hidden

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

122 files changed

+2049
-1070
lines changed

codeception.dist.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ settings:
99
extensions:
1010
enabled:
1111
- Codeception\Extension\RunFailed
12-
- Codeception\Extension\FailedInfo
1312
params:
1413
- vendor/magento/magento-cloud-docker/tests/functional/configuration.dist.yml
1514
- env

composer.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
"version": "2002.1.19",
66
"license": "OSL-3.0",
77
"repositories": {
8+
"mcd": {
9+
"type": "vcs",
10+
"url": "https://github.com/magento-commerce/magento-cloud-docker.git"
11+
},
812
"repo.magento.com": {
913
"type": "composer",
1014
"url": "https://repo.magento.com/"
@@ -16,17 +20,17 @@
1620
"ext-json": "*",
1721
"ext-sockets": "*",
1822
"colinmollenhour/credis": "^1.6.0 || ^1.13",
19-
"composer/composer": "^1.9 || ^2.0 || !=2.2.16",
23+
"composer/composer": "^1.9 || ^2.8 || !=2.2.16",
2024
"composer/semver": "@stable",
2125
"graylog2/gelf-php": "^2.0.1",
2226
"guzzlehttp/guzzle": "^7.3 || ^7.5",
23-
"illuminate/config": "^5.5||^8.77",
27+
"illuminate/config": "^10.0 || ^11.0",
2428
"magento/magento-cloud-components": "^1.0.8",
25-
"magento/magento-cloud-docker": "^1.0.0",
29+
"magento/magento-cloud-docker": "dev-MCLOUD-13147 as 1.3.99",
2630
"magento/magento-cloud-patches": "^1.0.20",
2731
"magento/quality-patches": "^1.1.0",
2832
"monolog/monolog": "^2.3 || ^2.7 || ^3.6",
29-
"nesbot/carbon": "^1.0 || ^2.0",
33+
"nesbot/carbon": "^1.0 || ^2.0 || ^3.8",
3034
"psr/container": "^1.0",
3135
"psr/log": "^1.0 || ^2.0 || ^3.0",
3236
"symfony/config": "^4.4 || ^5.1 || ^5.4 || ^6.4",
@@ -45,9 +49,9 @@
4549
"consolidation/robo": "^3.0",
4650
"php-mock/php-mock-phpunit": "^2.0",
4751
"phpmd/phpmd": "@stable",
48-
"phpstan/phpstan": "~1.2.0",
49-
"phpunit/php-code-coverage": "^9.2",
50-
"phpunit/phpunit": "^9.5",
52+
"phpstan/phpstan": "1.2.0 || ^2.0",
53+
"phpunit/php-code-coverage": "^10.0",
54+
"phpunit/phpunit": "^10.0",
5155
"squizlabs/php_codesniffer": "^3.0",
5256
"funkjedi/composer-include-files": "^1.0"
5357
},

src/App/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* @inheritdoc
2323
* @codeCoverageIgnore
24-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
24+
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
2525
*/
2626
class Container implements ContainerInterface
2727
{

src/App/ErrorHandler.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class ErrorHandler
3131
E_USER_ERROR => 'User Error',
3232
E_USER_WARNING => 'User Warning',
3333
E_USER_NOTICE => 'User Notice',
34-
E_STRICT => 'Strict Notice',
3534
E_RECOVERABLE_ERROR => 'Recoverable Error',
3635
E_DEPRECATED => 'Deprecated Functionality',
3736
E_USER_DEPRECATED => 'User Deprecated Functionality',

src/App/GenericException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
/**
1313
* Base exception for general purposes.
1414
*
15-
* @SuppressWarnings(PHPMD.NumberOfChildren)
15+
* @SuppressWarnings("PHPMD.NumberOfChildren")
1616
*/
1717
class GenericException extends \Exception
1818
{
1919
/**
2020
* @inheritDoc
2121
*/
22-
public function __construct(string $message, int $code = 0, Throwable $previous = null)
22+
public function __construct(string $message, int $code = 0, Throwable | null $previous = null)
2323
{
2424
parent::__construct($message, $code, $previous);
2525
}

src/App/Logger/Formatter/JsonErrorFormatter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function __construct(
5353
public function format(\Monolog\LogRecord|array $record): string
5454
{
5555
// Monolog version 3 or higher.
56+
/** @phpstan-ignore-next-line */
5657
if (\Monolog\Logger::API == 3) {
5758
try {
5859
/** @phpstan-ignore-next-line */

src/App/Logger/HandlerFactory.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/**
2424
* The handler factory.
2525
*
26-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
26+
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
2727
*/
2828
class HandlerFactory
2929
{
@@ -73,7 +73,7 @@ public function __construct(
7373
* @return AbstractProcessingHandler
7474
* @throws LoggerException
7575
*
76-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
76+
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
7777
*/
7878
public function create(string $handler): AbstractProcessingHandler
7979
{
@@ -172,6 +172,7 @@ private function normalizeLevel(string $level): int
172172
/** @phpstan-ignore-next-line */
173173
$normalizedLevel = Logger::toMonologLevel($level);
174174

175+
/** @phpstan-ignore-next-line */
175176
if (\Monolog\Logger::API == 3) {
176177
/** @phpstan-ignore-next-line */
177178
$normalizedLevel = $normalizedLevel->value;

src/App/Logger/Processor/SanitizeProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(Sanitizer $sanitizer)
3333
public function __invoke(\Monolog\LogRecord|array $record)
3434
{
3535
// Monolog version 3 or higher.
36-
if (\Monolog\Logger::API == 3) {
36+
if (\Monolog\Logger::API == 3) { // @phpstan-ignore-line
3737
$message = $this->sanitizer->sanitize($record->message); // @phpstan-ignore-line
3838
// Create new LogRecord from existing and update the message,
3939
// since message is read only

src/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* @inheritdoc
1717
*
18-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
18+
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
1919
*/
2020
class Application extends \Symfony\Component\Console\Application
2121
{

src/Command/ConfigShow/Renderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ protected function renderTable(OutputInterface $output, string $title, array $he
114114
$table = new Table($output);
115115
$table->setHeaders($header)
116116
->setRows($rows);
117-
if (method_exists($table, 'setColumnWidth')) {
117+
if (method_exists($table, 'setColumnWidth')) { // @phpstan-ignore-line
118118
$table->setColumnWidth(0, 40);
119119
$table->setColumnWidth(1, 60);
120120
}

src/Command/ConfigValidate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function configure(): void
5353
* @param OutputInterface $output
5454
* @return int
5555
*
56-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
56+
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
5757
*/
5858
public function execute(InputInterface $input, OutputInterface $output)
5959
{

src/Command/Dev/GenerateSchemaError.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
/**
1919
* @codeCoverageIgnore
20-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
20+
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
2121
*/
2222
class GenerateSchemaError extends Command
2323
{
@@ -60,7 +60,7 @@ protected function configure(): void
6060
/**
6161
* @inheritdoc
6262
*
63-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
63+
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
6464
*/
6565
protected function execute(InputInterface $input, OutputInterface $output): int
6666
{

src/Command/Dev/UpdateComposer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ protected function configure(): void
102102
* @throws ConfigException
103103
* @throws FileSystemException
104104
*
105-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
105+
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
106106
*/
107107
protected function execute(InputInterface $input, OutputInterface $output): int
108108
{

src/Config/Factory/Cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ private function isCacheConfigurationValid(array $cacheConfiguration): bool
218218
* @param array $redisConfig
219219
* @return bool
220220
* @throws ConfigException
221-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
221+
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
222222
*/
223223
private function isConfigurationCompatibleWithSlaveConnection(
224224
array $envCacheConfig,

src/Config/Validator/Build/BalerSupport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(
4747

4848
/**
4949
* {@inheritdoc}
50-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
50+
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
5151
*/
5252
public function validate(): Validator\ResultInterface
5353
{

src/Config/Validator/Deploy/AppropriateVersion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(
5151
/**
5252
* @return Validator\ResultInterface
5353
*
54-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
54+
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
5555
*/
5656
public function validate(): Validator\ResultInterface
5757
{

src/Config/Validator/Deploy/DeprecatedVariables.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public function __construct(
4848
*
4949
* {@inheritdoc}
5050
* Despite PHPMD warnings, this method is ultimately very linear: 1) Check condition; 2) Append error; etc.
51-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
52-
* @SuppressWarnings(PHPMD.NPathComplexity)
51+
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
52+
* @SuppressWarnings("PHPMD.NPathComplexity")
5353
*/
5454
public function validate(): Validator\ResultInterface
5555
{

src/Config/Validator/Deploy/ElasticSearchVersion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/**
2525
* Validates compatibility of elasticsearch and magento versions.
2626
*
27-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
27+
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
2828
*/
2929
class ElasticSearchVersion implements ValidatorInterface
3030
{

src/Config/Validator/Result/Error.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Error implements ResultInterface
3434
* @param string $suggestion
3535
* @param int|null $code
3636
*/
37-
public function __construct(string $message, string $suggestion = '', int $code = null)
37+
public function __construct(string $message, string $suggestion = '', int | null $code = null)
3838
{
3939
$this->message = $message;
4040
$this->suggestion = $suggestion;

src/Config/Validator/ResultFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function success(): Success
6464
* @param int|null $code
6565
* @return Error
6666
*/
67-
public function error(string $message, string $suggestion = '', int $code = null): Error
67+
public function error(string $message, string $suggestion = '', int | null $code = null): Error
6868
{
6969
return new Error($message, $suggestion, $code);
7070
}

src/Service/Adapter/CredisFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CredisFactory
2525
* @param string|null $password
2626
* @return Credis_Client
2727
*/
28-
public function create(string $server, int $port, int $database, string $password = null): Credis_Client
28+
public function create(string $server, int $port, int $database, string | null $password = null): Credis_Client
2929
{
3030
return new Credis_Client(
3131
$server,

src/StaticContent/CommandFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ public function matrix(OptionInterface $option, array $matrix): array
128128
/**
129129
* @param OptionInterface $option
130130
* @return string
131-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
132-
* @SuppressWarnings(PHPMD.NPathComplexity)
131+
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
132+
* @SuppressWarnings("PHPMD.NPathComplexity")
133133
*/
134134
private function build(OptionInterface $option): string
135135
{

src/Step/Deploy/InstallUpdate/ConfigUpdate/DbConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/**
2828
* Updates DB connection configuration.
2929
*
30-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
30+
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
3131
*/
3232
class DbConnection implements StepInterface
3333
{

src/Step/Deploy/InstallUpdate/Install/Setup/InstallCommandFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
/**
2929
* Generates command for magento installation
3030
*
31-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
32-
* @SuppressWarnings(PHPMD.NPathComplexity)
31+
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
32+
* @SuppressWarnings("PHPMD.NPathComplexity")
3333
*/
3434
class InstallCommandFactory
3535
{
@@ -111,7 +111,7 @@ class InstallCommandFactory
111111
* @param RemoteStorage $remoteStorage
112112
* @param AmqpConfig $amqpConfig
113113
*
114-
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
114+
* @SuppressWarnings("PHPMD.ExcessiveParameterList")
115115
*/
116116
public function __construct(
117117
UrlManager $urlManager,
@@ -244,7 +244,7 @@ private function getAdminOptions(): array
244244
* @throws UndefinedPackageException
245245
* @throws ConfigException
246246
* @throws ServiceException
247-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
247+
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
248248
*/
249249
private function getEsOptions(): array
250250
{

src/Step/Deploy/PreDeploy/CleanRedisCache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
/**
1919
* Cleans Redis cache.
2020
*
21-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
22-
* @SuppressWarnings(PHPMD.NPathComplexity)
21+
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
22+
* @SuppressWarnings("PHPMD.NPathComplexity")
2323
*/
2424
class CleanRedisCache implements StepInterface
2525
{

src/Step/Deploy/PreDeploy/ConfigUpdate/Cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* Processes cache configuration.
2323
*
24-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
24+
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
2525
*/
2626
class Cache implements StepInterface
2727
{

src/Step/Deploy/RemoteStorage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public function __construct(
6464
* Enables or disables remote storage.
6565
*
6666
* @throws StepException
67-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
68-
* @SuppressWarnings(PHPMD.NPathComplexity)
67+
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
68+
* @SuppressWarnings("PHPMD.NPathComplexity")
6969
*/
7070
public function execute(): void
7171
{

src/Step/Deploy/SplitDbConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* {@inheritDoc}
2929
*
30-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
30+
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
3131
* @deprecated started from Magento 2.4.2 and will be removed in 2.5.0
3232
*/
3333
class SplitDbConnection implements StepInterface

src/Step/PostDeploy/WarmUp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __construct(
6262

6363
/**
6464
* {@inheritdoc}
65-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
65+
* @SuppressWarnings("PHPMD.UnusedLocalVariable")
6666
*/
6767
public function execute()
6868
{

src/Test/Integration/Schema/ValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function setUp(): void
5353
public function testValidate(
5454
string $key,
5555
$value,
56-
ResultInterface $expected = null,
56+
ResultInterface | null $expected = null,
5757
string $stage = StageConfigInterface::STAGE_DEPLOY
5858
): void {
5959
$expected = $expected ?? new Success();

src/Test/Unit/App/Logger/Formatter/ErrorFormatterFactoryTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,20 @@ protected function setUp(): void
4242

4343
public function testCreate()
4444
{
45+
define("ERRORINFO", $this->createMock(ErrorInfo::class));
46+
define("READERINTEFACE", $this->getMockForAbstractClass(ReaderInterface::class));
4547
$this->containerMock->expects($this->exactly(2))
4648
->method('get')
47-
->withConsecutive(
48-
[ErrorInfo::class],
49-
[ReaderInterface::class]
50-
)
51-
->willReturnOnConsecutiveCalls(
52-
$this->createMock(ErrorInfo::class),
53-
$this->getMockForAbstractClass(ReaderInterface::class)
54-
);
49+
// withConsecutive() alternative.
50+
->willReturnCallback(function ($args) {
51+
static $series = [
52+
[ErrorInfo::class, ERRORINFO],
53+
[ReaderInterface::class, READERINTEFACE]
54+
];
55+
[$expectedArgs, $return] = array_shift($series);
56+
$this->assertSame($expectedArgs, $args);
57+
return $return;
58+
});
5559

5660
$errorFormatter = $this->errorFormatterFactory->create();
5761
$this->assertInstanceOf(JsonErrorFormatter::class, $errorFormatter);

0 commit comments

Comments
 (0)