Skip to content

Commit c52a6d7

Browse files
ACPT-1666 & ACPT-1552
fixing static test failures
1 parent 987558c commit c52a6d7

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

lib/internal/Magento/Framework/ObjectManager/Resetter/SortableReferenceObject.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public function getSort() : int
3535
return $this->sort;
3636
}
3737

38+
/**
39+
* Gets WeakReference
40+
*
41+
* @return WeakReference
42+
*/
3843
public function getWeakReference() : WeakReference
3944
{
4045
return $this->reference;

lib/internal/Magento/Framework/ObjectManager/Resetter/WeakMapSorter.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,13 @@ class WeakMapSorter
2222

2323
public const MAX_SORT_VALUE = 10000;
2424

25-
/**
26-
* @var SortableReferenceObject[]
27-
*/
28-
private array $sortableReferenceList = [];
29-
3025
/**
3126
* Constructor
3227
*
3328
* @param array<string, int> $sortOrder
3429
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
3530
*/
36-
public function __construct (private array $sortOrder)
31+
public function __construct(private array $sortOrder)
3732
{
3833
// Note: Even though they are declared as xsi:type="number", they are still strings, so we convert them here.
3934
foreach ($this->sortOrder as &$value) {
@@ -42,8 +37,11 @@ public function __construct (private array $sortOrder)
4237
}
4338

4439
/**
40+
* Sorts the WeakMap into a WeakReference list
41+
*
4542
* @param WeakMap $weakmap
4643
* @return WeakReference[]
44+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
4745
*/
4846
public function sortWeakMapIntoWeakReferenceList(WeakMap $weakmap) : array
4947
{
@@ -69,17 +67,20 @@ public function sortWeakMapIntoWeakReferenceList(WeakMap $weakmap) : array
6967
}
7068

7169
/**
70+
* Gets sort value for the specified object
71+
*
7272
* @param object $object
7373
* @return int
7474
*/
7575
private function getSortValueOfObject(object $object) : int
7676
{
7777
$className = get_class($object);
78-
if (array_key_exists($className , $this->sortOrder)) {
78+
if (array_key_exists($className, $this->sortOrder)) {
7979
return $this->sortOrder[$className];
8080
}
81+
// phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
8182
for ($parentClass = $className; $parentClass = get_parent_class($parentClass);) {
82-
if (array_key_exists($parentClass , $this->sortOrder)) {
83+
if (array_key_exists($parentClass, $this->sortOrder)) {
8384
$sortValue = $this->sortOrder[$parentClass];
8485
$this->sortOrder[$className] = $sortValue;
8586
return $sortValue;

lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/DynamicFactoryDecorator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ public function create($type, array $arguments = [])
8181
public function _resetState(): void
8282
{
8383
$this->resetter->_resetState();
84-
return;
8584
}
8685

8786
/**

lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Resetter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ class Resetter extends OriginalResetter
3737
*/
3838
private readonly array $skipList;
3939

40+
/** @var ObjectManagerInterface */
4041
private ObjectManagerInterface $objectManager;
4142

43+
/** @var WeakMapSorter|null */
4244
private ?WeakMapSorter $weakMapSorter = null;
4345

4446
/**

0 commit comments

Comments
 (0)