Browse Source

Clarify message when no composer.json is present in the repo

Jordi Boggiano 13 years ago
parent
commit
7643de13e3
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/Packagist/WebBundle/Entity/Package.php

+ 6 - 1
src/Packagist/WebBundle/Entity/Package.php

@@ -172,7 +172,12 @@ class Package
         try {
         try {
             $information = $driver->getComposerInformation($driver->getRootIdentifier());
             $information = $driver->getComposerInformation($driver->getRootIdentifier());
 
 
-            if (!isset($information['name']) || !$information['name']) {
+            if (false === $information) {
+                $context->addViolationAtSubPath($property, 'No composer.json was found in the '.$driver->getRootIdentifier().' branch.', array(), null);
+                return;
+            }
+
+            if (empty($information['name'])) {
                 $context->addViolationAtSubPath($property, 'The package name was not found in the composer.json, make sure there is a name present.', array(), null);
                 $context->addViolationAtSubPath($property, 'The package name was not found in the composer.json, make sure there is a name present.', array(), null);
                 return;
                 return;
             }
             }