Browse Source

Fixed issues with PR

MakiCode 9 năm trước cách đây
mục cha
commit
63ede6c9dd

+ 4 - 4
src/Composer/Command/ArchiveCommand.php

@@ -40,9 +40,9 @@ class ArchiveCommand extends Command
             ->setDefinition(array(
                 new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
                 new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
-                new InputOption('format', 'f', InputOption::VALUE_OPTIONAL, 'Format of the resulting archive: tar or zip'),
-                new InputOption('dir', false, InputOption::VALUE_OPTIONAL, 'Write the archive to this directory'),
-                new InputOption('file', false, InputOption::VALUE_OPTIONAL, 'Write the archive with the given file name.'
+                new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
+                new InputOption('dir', false, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
+                new InputOption('file', false, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
                     .' Note that the format will be appended.'),
             ))
             ->setHelp(<<<EOT
@@ -81,7 +81,7 @@ EOT
             $input->getArgument('version'),
             $input->getOption('format'),
             $input->getOption('dir'),
-            $input->getOption("file")
+            $input->getOption('file')
         );
 
         if (0 === $returnCode && $composer) {

+ 2 - 2
src/Composer/Package/Archiver/ArchiveManager.php

@@ -108,7 +108,7 @@ class ArchiveManager
         if (empty($format)) {
             throw new \InvalidArgumentException('Format must be specified');
         }
-        if(!is_null($fileName) && !is_string($fileName)) {
+        if (null !== $fileName && !is_string($fileName)) {
             throw new \InvalidArgumentException('fileName must be a string');
         }
 
@@ -127,7 +127,7 @@ class ArchiveManager
         }
 
         $filesystem = new Filesystem();
-        if(null === $fileName) {
+        if (null !== $fileName) {
             $packageName = $this->getPackageFilename($package);
         } else {
             $packageName = $fileName;

+ 5 - 4
tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php

@@ -66,11 +66,11 @@ class ArchiveManagerTest extends ArchiverTest
 
         $package = $this->setupPackage();
 
-        $fileName =  "testArchiveName";
+        $fileName = 'testArchiveName';
 
         $this->manager->archive($package, 'tar', $this->targetDir, $fileName);
 
-        $target =  $this->targetDir . "/" . $fileName . ".tar";
+        $target = $this->targetDir . '/' . $fileName . '.tar';
 
         $this->assertFileExists($target);
 
@@ -80,8 +80,9 @@ class ArchiveManagerTest extends ArchiverTest
         unlink($target);
     }
 
-    public function testNonStringFileName() {
-        $this->setExpectedException("InvalidArgumentException");
+    public function testNonStringFileName()
+    {
+        $this->setExpectedException('InvalidArgumentException');
 
         $package = $this->setupPackage();