@@ -59,22 +59,32 @@ class PackageInfo
5959 protected $ nonExistingDependencies = [];
6060
6161 /**
62- * Constructor
63- *
62+ * @var \Magento\Framework\Serialize\Serializer\Json
63+ */
64+ private $ serializer ;
65+
66+ /**
6467 * @param Dir\Reader $reader
6568 * @param ComponentRegistrar $componentRegistrar
69+ * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
70+ * @throws \RuntimeException
6671 */
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+ ) {
6977 $ this ->reader = $ reader ;
7078 $ this ->componentRegistrar = $ componentRegistrar ;
79+ $ this ->serializer = $ serializer ?: \Magento \Framework \App \ObjectManager::getInstance ()
80+ ->get (\Magento \Framework \Serialize \Serializer \Json::class);
7181 }
7282
7383 /**
7484 * Load the packages information
7585 *
7686 * @return void
77- * @throws \Zend_Json_Exception
87+ * @throws \InvalidArgumentException
7888 * @SuppressWarnings(PHPMD.CyclomaticComplexity)
7989 */
8090 private function load ()
@@ -85,9 +95,9 @@ private function load()
8595 $ key = $ moduleDir . '/composer.json ' ;
8696 if (isset ($ jsonData [$ key ]) && $ jsonData [$ key ]) {
8797 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 (
91101 sprintf (
92102 "%s composer.json error: %s " ,
93103 $ moduleName ,
0 commit comments