Skip to content

Commit bb8f5b4

Browse files
committed
MC-16607: Fix Unrelated Static Test Failures
- use ObjectManager - wrap zend functions instead of inheritence
1 parent 53e3db6 commit bb8f5b4

File tree

2 files changed

+98
-2
lines changed

2 files changed

+98
-2
lines changed

app/code/Magento/Reports/Block/Adminhtml/Grid.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ public function __construct(
105105
DecoderInterface::class
106106
);
107107

108-
$this->parameters = $parameters ?? new Parameters();
108+
$this->parameters = $parameters ?? ObjectManager::getInstance()->get(
109+
Parameters::class
110+
);
109111

110112
parent::__construct($context, $backendHelper, $data);
111113
}

lib/internal/Magento/Framework/Stdlib/Parameters.php

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,103 @@
77

88
namespace Magento\Framework\Stdlib;
99

10+
use Zend\Stdlib\Parameters as ZendParameters;
11+
1012
/**
1113
* Class Parameters
1214
*/
13-
class Parameters extends \Zend\Stdlib\Parameters
15+
class Parameters
1416
{
17+
/**
18+
* @var ZendParameters
19+
*/
20+
private $parameters;
21+
22+
/**
23+
* @param ZendParameters $parameters
24+
*/
25+
public function __construct(
26+
ZendParameters $parameters
27+
) {
28+
$this->parameters = $parameters;
29+
}
30+
31+
/**
32+
* Populate from native PHP array
33+
*
34+
* @param array $values
35+
* @return void
36+
*/
37+
public function fromArray(array $values)
38+
{
39+
$this->parameters->fromArray($values);
40+
}
41+
42+
/**
43+
* Populate from query string
44+
*
45+
* @param string $string
46+
* @return void
47+
*/
48+
public function fromString($string)
49+
{
50+
$this->parameters->fromString($string);
51+
}
52+
53+
/**
54+
* Serialize to native PHP array
55+
*
56+
* @return array
57+
*/
58+
public function toArray()
59+
{
60+
return $this->parameters->toArray();
61+
}
62+
63+
/**
64+
* Serialize to query string
65+
*
66+
* @return string
67+
*/
68+
public function toString()
69+
{
70+
return $this->parameters->toString();
71+
}
72+
73+
/**
74+
* Retrieve by key
75+
*
76+
* Returns null if the key does not exist.
77+
*
78+
* @param string $name
79+
* @return mixed
80+
*/
81+
public function offsetGet($name)
82+
{
83+
return $this->parameters->offsetGet($name);
84+
}
85+
86+
/**
87+
* Get name
88+
*
89+
* @param string $name
90+
* @param mixed $default optional default value
91+
* @return mixed
92+
*/
93+
public function get($name, $default = null)
94+
{
95+
return $this->parameters->get($name, $default);
96+
}
97+
98+
/**
99+
* Set name
100+
*
101+
* @param string $name
102+
* @param mixed $value
103+
* @return \Zend\Stdlib\Parameters
104+
*/
105+
public function set($name, $value)
106+
{
107+
return $this->parameters->set($name, $value);
108+
}
15109
}

0 commit comments

Comments
 (0)