@@ -59,22 +59,32 @@ class PackageInfo
59
59
protected $ nonExistingDependencies = [];
60
60
61
61
/**
62
- * Constructor
63
- *
62
+ * @var \Magento\Framework\Serialize\Serializer\Json
63
+ */
64
+ private $ serializer ;
65
+
66
+ /**
64
67
* @param Dir\Reader $reader
65
68
* @param ComponentRegistrar $componentRegistrar
69
+ * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
70
+ * @throws \RuntimeException
66
71
*/
67
- public function __construct (Dir \Reader $ reader , ComponentRegistrar $ componentRegistrar )
68
- {
72
+ public function __construct (
73
+ Dir \Reader $ reader ,
74
+ ComponentRegistrar $ componentRegistrar ,
75
+ \Magento \Framework \Serialize \Serializer \Json $ serializer = null
76
+ ) {
69
77
$ this ->reader = $ reader ;
70
78
$ this ->componentRegistrar = $ componentRegistrar ;
79
+ $ this ->serializer = $ serializer ?: \Magento \Framework \App \ObjectManager::getInstance ()
80
+ ->get (\Magento \Framework \Serialize \Serializer \Json::class);
71
81
}
72
82
73
83
/**
74
84
* Load the packages information
75
85
*
76
86
* @return void
77
- * @throws \Zend_Json_Exception
87
+ * @throws \InvalidArgumentException
78
88
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
79
89
*/
80
90
private function load ()
@@ -85,9 +95,9 @@ private function load()
85
95
$ key = $ moduleDir . '/composer.json ' ;
86
96
if (isset ($ jsonData [$ key ]) && $ jsonData [$ key ]) {
87
97
try {
88
- $ packageData = \Zend_Json:: decode ($ jsonData [$ key ]);
89
- } catch (\Zend_Json_Exception $ e ) {
90
- throw new \Zend_Json_Exception (
98
+ $ packageData = $ this -> serializer -> unserialize ($ jsonData [$ key ]);
99
+ } catch (\InvalidArgumentException $ e ) {
100
+ throw new \InvalidArgumentException (
91
101
sprintf (
92
102
"%s composer.json error: %s " ,
93
103
$ moduleName ,
0 commit comments