Browse Source

Fix phpstan reported error in Xml class.

ADmad 8 years ago
parent
commit
dcf59f79f4
1 changed files with 14 additions and 2 deletions
  1. 14 2
      src/Utility/Xml.php

+ 14 - 2
src/Utility/Xml.php

@@ -328,8 +328,20 @@ class Xml
      */
     protected static function _createChild($data)
     {
-        $value = $dom = $key = $format = $node = null;
-        extract($data);
+        $data += [
+            'dom' => null,
+            'node' => null,
+            'key' => null,
+            'value' => null,
+            'format' => null,
+        ];
+
+        $value = $data['value'];
+        $dom = $data['dom'];
+        $key = $data['key'];
+        $format = $data['format'];
+        $node = $data['node'];
+
         $childNS = $childValue = null;
         if (is_object($value) && method_exists($value, 'toArray') && is_callable([$value, 'toArray'])) {
             $value = call_user_func([$value, 'toArray']);