Skip to content

Commit a41a139

Browse files
authored
Merge pull request #578 from magento-performance/ACPT-1688
ACPT-1688: Fix Static Tests failures on Application-Server branch CE
2 parents b4e74c8 + 57365d2 commit a41a139

File tree

26 files changed

+285
-93
lines changed

26 files changed

+285
-93
lines changed

app/code/Magento/ApplicationPerformanceMonitor/Profiler/Metric.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,61 @@
88
namespace Magento\ApplicationPerformanceMonitor\Profiler;
99

1010
/**
11-
* A single metric. Type is currently either MEMORY or TIME.
11+
* A single metric. Type is currently either MEMORY or TIME.
1212
* This class is an immutable data object.
1313
*/
1414
class Metric
1515
{
1616
/**
17-
* @param string $type
17+
* @param MetricType $type
1818
* @param string $name
1919
* @param mixed $value
2020
* @param bool $verbose
2121
*/
2222
public function __construct(
23-
private readonly string $type,
23+
private readonly MetricType $type,
2424
private readonly string $name,
2525
private readonly mixed $value,
2626
private readonly bool $verbose,
2727
) {
2828
}
2929

3030
/**
31-
* @return string
31+
* Gets type of metric
32+
*
33+
* @return int|MetricType
3234
*/
33-
public function getType()
35+
public function getType(): MetricType|int
3436
{
3537
return $this->type;
3638
}
3739

3840
/**
41+
* Gets a name
42+
*
3943
* @return string
4044
*/
41-
public function getName()
45+
public function getName(): string
4246
{
4347
return $this->name;
4448
}
4549

4650
/**
51+
* Gets a value
52+
*
4753
* @return mixed
4854
*/
49-
public function getValue()
55+
public function getValue(): mixed
5056
{
5157
return $this->value;
5258
}
5359

5460
/**
61+
* Checks if verbose
62+
*
5563
* @return bool
5664
*/
57-
public function isVerbose()
65+
public function isVerbose(): bool
5866
{
5967
return $this->verbose;
6068
}

app/code/Magento/ApplicationPerformanceMonitor/Profiler/Metrics.php

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@
88
namespace Magento\ApplicationPerformanceMonitor\Profiler;
99

1010
/**
11-
* Gathers and stores metrics. Compares against another one to get the deltas.
11+
* Gathers and stores metrics. Compares against another one to get the deltas.
1212
*/
1313
class Metrics
1414
{
15+
/**
16+
* @param int $peakMemoryUsage
17+
* @param int $memoryUsage
18+
* @param array $rusage
19+
* @param float $microtime
20+
*/
1521
public function __construct(
1622
private readonly int $peakMemoryUsage,
1723
private readonly int $memoryUsage,
@@ -20,21 +26,41 @@ public function __construct(
2026
) {
2127
}
2228

29+
/**
30+
* Gets peak memory usage
31+
*
32+
* @return int
33+
*/
2334
public function getPeakMemoryUsage() : int
2435
{
2536
return $this->peakMemoryUsage;
2637
}
2738

39+
/**
40+
* Gets memory usage
41+
*
42+
* @return int
43+
*/
2844
public function getMemoryUsage() : int
2945
{
3046
return $this->memoryUsage;
3147
}
3248

49+
/**
50+
* Gets fusage
51+
*
52+
* @return array
53+
*/
3354
public function getRusage() : array
3455
{
3556
return $this->rusage;
3657
}
3758

59+
/**
60+
* Gets microtime
61+
*
62+
* @return float
63+
*/
3864
public function getMicrotime() : float
3965
{
4066
return $this->microtime;

app/code/Magento/ApplicationPerformanceMonitorNewRelic/Profiler/Output/NewRelicOutput.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ class NewRelicOutput implements OutputInterface
2020
public const CONFIG_ENABLE_KEY = 'application/performance_monitor/newrelic_output_enable';
2121
public const CONFIG_VERBOSE_KEY = 'application/performance_monitor/newrelic_output_verbose';
2222

23+
/**
24+
* @param DeploymentConfig $deploymentConfig
25+
* @param NewRelicWrapper $newRelicWrapper
26+
*/
2327
public function __construct(
2428
private readonly DeploymentConfig $deploymentConfig,
2529
private readonly NewRelicWrapper $newRelicWrapper

app/code/Magento/CatalogGraphQl/DataProvider/Product/RequestDataBuilder.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,41 @@
1212
*/
1313
class RequestDataBuilder implements ResetAfterRequestInterface
1414
{
15+
/**
16+
* @var array
17+
*/
1518
private array $data;
1619

20+
/**
21+
* Constructor
22+
*
23+
* @return void
24+
*/
1725
public function __construct()
1826
{
1927
$this->_resetState();
2028
}
2129

22-
public function setData($data)
30+
/**
31+
* Sets request data
32+
*
33+
* @param array $data
34+
* @return void
35+
*/
36+
public function setData(array $data): void
2337
{
2438
$this->data = $data;
2539
}
2640

27-
public function getData(string $key)
41+
/**
42+
* Gets request data
43+
*
44+
* @param string $key
45+
* @return mixed|null
46+
*/
47+
public function getData(string $key): mixed
2848
{
2949
return $this->data[$key] ?? null;
30-
3150
}
3251

3352
/**

app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ class SearchCriteriaBuilder
6969
*/
7070
private SearchConfig $searchConfig;
7171

72+
/**
73+
* @var RequestDataBuilder|mixed
74+
*/
7275
private RequestDataBuilder $localData;
7376

7477
/**
@@ -80,6 +83,7 @@ class SearchCriteriaBuilder
8083
* @param SortOrderBuilder|null $sortOrderBuilder
8184
* @param Config|null $eavConfig
8285
* @param SearchConfig|null $searchConfig
86+
* @param RequestDataBuilder|null $localData
8387
*/
8488
public function __construct(
8589
Builder $builder,

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/Price/Provider.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,23 @@ class Provider implements ProviderInterface, ResetAfterRequestInterface
3434
RegularPrice::PRICE_CODE => []
3535
];
3636

37+
/**
38+
* @var array|array[]
39+
*
40+
* phpcs:disable Magento2.Commenting.ClassPropertyPHPDocFormatting
41+
*/
3742
private readonly array $minimalPriceConstructed;
43+
44+
/**
45+
* @var array|array[]
46+
*
47+
* phpcs:disable Magento2.Commenting.ClassPropertyPHPDocFormatting
48+
*/
3849
private readonly array $maximalPriceConstructed;
3950

51+
/**
52+
* Constructor
53+
*/
4054
public function __construct()
4155
{
4256
$this->minimalPriceConstructed = $this->minimalPrice;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CatalogGraphQl\Plugin\Search;
9+
10+
use Magento\CatalogGraphQl\DataProvider\Product\RequestDataBuilder;
11+
use Magento\Framework\Search\Request\Config;
12+
13+
class RequestBuilderPlugin
14+
{
15+
/**
16+
* Constructor
17+
*
18+
* @param RequestDataBuilder $localData
19+
* @phpcs:disable Magento2.CodeAnalysis.EmptyBlock
20+
*/
21+
public function __construct(private RequestDataBuilder $localData)
22+
{
23+
}
24+
25+
/**
26+
* Get around
27+
*
28+
* @param Config $subject
29+
* @param callable $proceed
30+
* @param string $requestName
31+
* @return array
32+
*/
33+
public function aroundGet(Config $subject, callable $proceed, string $requestName)
34+
{
35+
if ($this->localData->getData($requestName)) {
36+
return $this->localData->getData($requestName);
37+
} else {
38+
return $proceed($requestName);
39+
}
40+
}
41+
}

app/code/Magento/CatalogGraphQl/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@
101101
</argument>
102102
</arguments>
103103
</type>
104-
105104
<type name="Magento\Framework\Search\Request\Config\FilesystemReader">
106105
<plugin name="productAttributesDynamicFields" type="Magento\CatalogGraphQl\Plugin\Search\Request\ConfigReader" />
107106
</type>
@@ -112,6 +111,7 @@
112111
<item name="EAV" xsi:type="string">EAV</item>
113112
</argument>
114113
</arguments>
114+
<plugin name="localRequestDataPlugin" type="Magento\CatalogGraphQl\Plugin\Search\RequestBuilderPlugin" />
115115
</type>
116116

117117
<preference type="Magento\CatalogGraphQl\Model\Resolver\Product\Price\Provider" for="Magento\CatalogGraphQl\Model\Resolver\Product\Price\ProviderInterface"/>

app/code/Magento/Config/App/Config/ReloadConfig.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@
88

99
use Magento\Config\App\Config\Type\System;
1010
use Magento\Framework\App\State\ReloadProcessorInterface;
11-
use Magento\Framework\ObjectManagerInterface;
1211

1312
/**
1413
* Config module specific reset state
1514
*/
1615
class ReloadConfig implements ReloadProcessorInterface
1716
{
17+
/**
18+
* @param System $system
19+
*/
1820
public function __construct(private readonly System $system)
19-
{}
21+
{
22+
}
2023

2124
/**
2225
* Tells the system state to reload itself.
2326
*
24-
* @param ObjectManagerInterface $objectManager
2527
* @return void
2628
*/
2729
public function reloadState(): void

app/code/Magento/Customer/Helper/Address.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class Address extends \Magento\Framework\App\Helper\AbstractHelper implements Re
8686
* @var CustomerMetadataInterface
8787
*
8888
* @deprecated 101.0.0
89-
* phpcs:disable Magento2.Annotation.ClassPropertyPHPDocFormatting
89+
* phpcs:disable Magento2.Commenting.ClassPropertyPHPDocFormatting
9090
*/
9191
protected $_customerMetadataService;
9292

0 commit comments

Comments
 (0)