Parcourir la source

[FrameworkBundle] fixed init:bundle command

Fabien Potencier il y a 14 ans
Parent
commit
f35f1e1f3c

+ 5 - 3
src/Symfony/Bundle/FrameworkBundle/Command/InitBundleCommand.php

@@ -71,16 +71,18 @@ EOT
 
 
         // user specified bundle name?
         // user specified bundle name?
         $bundle = $input->getArgument('bundleName');
         $bundle = $input->getArgument('bundleName');
-        if ('' === $bundle) {
+        if (!$bundle) {
             $bundle = strtr($namespace, array('\\' => ''));
             $bundle = strtr($namespace, array('\\' => ''));
-        } elseif (!preg_match('/Bundle$/', $bundle)) {
+        }
+
+        if (!preg_match('/Bundle$/', $bundle)) {
             throw new \InvalidArgumentException('The bundle name must end with Bundle.');
             throw new \InvalidArgumentException('The bundle name must end with Bundle.');
         }
         }
 
 
         $dir = $input->getArgument('dir');
         $dir = $input->getArgument('dir');
 
 
         // add trailing / if necessary
         // add trailing / if necessary
-        $dir = '/' === substr($dir, -1, 1) ? $dir : $dir . '/';
+        $dir = '/' === substr($dir, -1, 1) ? $dir : $dir.'/';
 
 
         $targetDir = $dir.strtr($namespace, '\\', '/');
         $targetDir = $dir.strtr($namespace, '\\', '/');