Przeglądaj źródła

Merge pull request #6281 from swumao/master

Add config>platform checking
Jordi Boggiano 8 lat temu
rodzic
commit
4a6013d0f4

+ 10 - 0
src/Composer/Package/Loader/ValidatingArrayLoader.php

@@ -63,6 +63,16 @@ class ValidatingArrayLoader implements LoaderInterface
                 unset($this->config['version']);
             }
         }
+        
+        if (!empty($this->config['config']['platform'])) {
+            foreach ((array)$this->config['config']['platform'] as $key=>$platform) {
+                try {
+                    $this->versionParser->normalize($platform);
+                } catch (\Exception $e) {
+                    $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
+                }
+            }
+        }
 
         $this->validateRegex('type', '[A-Za-z0-9-]+');
         $this->validateString('target-dir');