|
@@ -130,17 +130,18 @@ class Package
|
|
|
}
|
|
|
try {
|
|
|
$information = $repo->getComposerInformation($repo->getRootIdentifier());
|
|
|
- } catch (\UnexpectedValueException $e) {}
|
|
|
- // TODO use more specialized exception for repos
|
|
|
|
|
|
- if (!isset($information['name']) || !$information['name']) {
|
|
|
- $context->addViolation('The package name was not found, your composer.json file must be invalid or missing in your master branch/trunk. Maybe the URL you entered has a typo.', array(), null);
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (!isset($information['name']) || !$information['name']) {
|
|
|
+ $context->addViolation('The package name was not found in the composer.json, make sure there is a name present.', array(), null);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- if (!preg_match('{^[a-z0-9_-]+/[a-z0-9_-]+$}i', $information['name'])) {
|
|
|
- $context->addViolation('The package name '.$information['name'].' is invalid, it should have a vendor name, a forward slash, and a package name, matching <em>[a-z0-9_-]+/[a-z0-9_-]+</em>.', array(), null);
|
|
|
- return;
|
|
|
+ if (!preg_match('{^[a-z0-9_-]+/[a-z0-9_-]+$}i', $information['name'])) {
|
|
|
+ $context->addViolation('The package name '.$information['name'].' is invalid, it should have a vendor name, a forward slash, and a package name, matching <em>[a-z0-9_-]+/[a-z0-9_-]+</em>.', array(), null);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } catch (\UnexpectedValueException $e) {
|
|
|
+ $context->addViolation('We had problems parsing your composer.json file, the parser reports: '.$e->getMessage(), array(), null);
|
|
|
}
|
|
|
}
|
|
|
|