File tree Expand file tree Collapse file tree 3 files changed +10
-15
lines changed
lib/internal/Magento/Framework
TestFramework/ApplicationStateComparator Expand file tree Collapse file tree 3 files changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,18 @@ class Resetter implements ResetterInterface
37
37
private array $ reflectionCache = [];
38
38
39
39
/**
40
- * @param ComponentRegistrarInterface $componentRegistrar
40
+ * @param ComponentRegistrarInterface|null $componentRegistrar
41
41
* @param array $classList
42
42
* @return void
43
43
* @phpcs:disable Magento2.Functions.DiscouragedFunction
44
44
*/
45
45
public function __construct (
46
- private ComponentRegistrarInterface $ componentRegistrar ,
46
+ private ? ComponentRegistrarInterface $ componentRegistrar = null ,
47
47
private array $ classList = [],
48
48
) {
49
+ if (null === $ componentRegistrar ) {
50
+ $ componentRegistrar = new ComponentRegistrar ();
51
+ }
49
52
foreach ($ this ->getPaths () as $ resetPath ) {
50
53
if (!\file_exists ($ resetPath )) {
51
54
continue ;
Original file line number Diff line number Diff line change 7
7
8
8
namespace Magento \Framework \ObjectManager \Resetter ;
9
9
10
- use Magento \Framework \ObjectManagerInterface ;
11
-
12
10
/**
13
11
* Factory that creates Resetter based on environment variable.
14
12
*/
@@ -19,21 +17,15 @@ class ResetterFactory
19
17
*/
20
18
private static string $ resetterClassName = Resetter::class;
21
19
22
- /**
23
- * @param ObjectManagerInterface $objectManager
24
- */
25
- public function __construct (private ObjectManagerInterface $ objectManager )
26
- {
27
- }
28
-
29
20
/**
30
21
* Create resseter instance
31
22
*
32
23
* @return ResetterInterface
24
+ * @phpcs:disable Magento2.Functions.StaticFunction
33
25
*/
34
- public function create () : ResetterInterface
26
+ public static function create () : ResetterInterface
35
27
{
36
- return $ this -> objectManager -> create ( static ::$ resetterClassName) ;
28
+ return new static::$ resetterClassName ;
37
29
}
38
30
39
31
/**
Original file line number Diff line number Diff line change @@ -34,11 +34,11 @@ class Resetter extends OriginalResetter
34
34
/**
35
35
* Constructor
36
36
*
37
- * @param ComponentRegistrarInterface $componentRegistrar
37
+ * @param ComponentRegistrarInterface|null $componentRegistrar
38
38
* @param array $classList
39
39
* @return void
40
40
*/
41
- public function __construct (ComponentRegistrarInterface $ componentRegistrar , array $ classList = [])
41
+ public function __construct (? ComponentRegistrarInterface $ componentRegistrar = null , array $ classList = [])
42
42
{
43
43
$ this ->collectedWeakMap = new WeakMap ;
44
44
$ this ->skipListAndFilterList = new SkipListAndFilterList ;
You can’t perform that action at this time.
0 commit comments