Browse Source

Tweaking previous merge

Jordi Boggiano 12 years ago
parent
commit
b47b24841e
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/Packagist/WebBundle/Entity/Package.php

+ 3 - 3
src/Packagist/WebBundle/Entity/Package.php

@@ -165,11 +165,11 @@ class Package
                 return;
             }
 
-            if (preg_match('{[A-Z}', $information['name'])) {
-                $suggestName = preg_replace('/(([a-z])([A-Z])|([A-Z])([A-Z][a-z]))/', '\\2\\4-\\3\\5', $information['name']);
+            if (preg_match('{[A-Z]}', $information['name'])) {
+                $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $information['name']);
                 $suggestName = strtolower($suggestName);
 
-                $context->addViolationAtSubPath($property, 'The package name '.$information['name'].' is invalid, it should not contain uppercase characters. We suggect using '.$suggestName.' instead.');
+                $context->addViolationAtSubPath($property, 'The package name '.$information['name'].' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.');
                 return;
             }
         } catch (\Exception $e) {