Parcourir la source

Check that a repo has no providers when getPackages is called to catch any mis-use

Jordi Boggiano il y a 12 ans
Parent
commit
41392ace56
1 fichiers modifiés avec 9 ajouts et 0 suppressions
  1. 9 0
      src/Composer/Repository/ComposerRepository.php

+ 9 - 0
src/Composer/Repository/ComposerRepository.php

@@ -89,6 +89,15 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
         $this->rootAliases = $rootAliases;
     }
 
+    public function getPackages()
+    {
+        if ($this->hasProviders()) {
+            throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
+        }
+
+        return parent::getPackages();
+    }
+
     /**
      * {@inheritDoc}
      */