Просмотр исходного кода

minor #1718 CLI: rename --config-file argument (keradus)

This PR was merged into the 2.0-dev branch.

Discussion
----------

CLI: rename --config-file argument

Commits
-------

b1fea58 CLI: rename --config-file argument
Dariusz Ruminski 9 лет назад
Родитель
Сommit
889208985f

+ 1 - 1
README.rst

@@ -718,7 +718,7 @@ which lets you configure the rules, the files and directories that
 need to be analyzed. You may also create ``.php_cs`` file, which is
 the local configuration that will be used instead of the project configuration. It
 is a good practice to add that file into your ``.gitignore`` file.
-With the ``--config-file`` option you can specify the path to the
+With the ``--config`` option you can specify the path to the
 ``.php_cs`` file.
 
 The example below will add two fixers to the default list of PSR2 set fixers:

+ 3 - 3
src/Console/Command/FixCommand.php

@@ -107,7 +107,7 @@ final class FixCommand extends Command
                 array(
                     new InputArgument('path', InputArgument::OPTIONAL, 'The path', null),
                     new InputOption('allow-risky', '', InputOption::VALUE_REQUIRED, 'Are risky fixers allowed (can be yes or no)', null),
-                    new InputOption('config-file', '', InputOption::VALUE_OPTIONAL, 'The path to a .php_cs file ', null),
+                    new InputOption('config', '', InputOption::VALUE_OPTIONAL, 'The path to a .php_cs file ', null),
                     new InputOption('dry-run', '', InputOption::VALUE_NONE, 'Only shows which files would have been modified'),
                     new InputOption('rules', '', InputOption::VALUE_REQUIRED, 'The rules', null),
                     new InputOption('using-cache', '', InputOption::VALUE_REQUIRED, 'Does cache should be used (can be yes or no)', null),
@@ -176,7 +176,7 @@ which lets you configure the rules, the files and directories that
 need to be analyzed. You may also create <comment>.php_cs</comment> file, which is
 the local configuration that will be used instead of the project configuration. It
 is a good practice to add that file into your <comment>.gitignore</comment> file.
-With the <comment>--config-file</comment> option you can specify the path to the
+With the <comment>--config</comment> option you can specify the path to the
 <comment>.php_cs</comment> file.
 
 The example below will add two fixers to the default list of PSR2 set fixers:
@@ -313,7 +313,7 @@ EOF
             ->setFixer($this->fixer)
             ->setOptions(array(
                 'allow-risky' => $input->getOption('allow-risky'),
-                'config-file' => $input->getOption('config-file'),
+                'config' => $input->getOption('config'),
                 'dry-run' => $input->getOption('dry-run'),
                 'rules' => $input->getOption('rules'),
                 'path' => $input->getArgument('path'),

+ 3 - 3
src/Console/ConfigurationResolver.php

@@ -91,7 +91,7 @@ final class ConfigurationResolver
      */
     private $options = array(
         'allow-risky' => null,
-        'config-file' => null,
+        'config' => null,
         'dry-run' => null,
         'format' => 'txt',
         'path' => null,
@@ -321,7 +321,7 @@ final class ConfigurationResolver
      */
     private function computeConfigFiles()
     {
-        $configFile = $this->options['config-file'];
+        $configFile = $this->options['config'];
 
         if (null !== $configFile) {
             if (false === file_exists($configFile) || false === is_readable($configFile)) {
@@ -372,7 +372,7 @@ final class ConfigurationResolver
     }
 
     /**
-     * Resolve config based on options: config, config-file.
+     * Resolve config.
      */
     private function resolveConfig()
     {

+ 1 - 1
tests/Console/Command/FixCommandTest.php

@@ -250,7 +250,7 @@ final class FixCommandTest extends \PHPUnit_Framework_TestCase
 
         $options = array_merge(
             array(
-                'config-file' => __DIR__.'/../../Fixtures/FixCommand/.phpcs',
+                'config' => __DIR__.'/../../Fixtures/FixCommand/.phpcs',
                 'format' => 'txt',
             ),
             $options

+ 3 - 3
tests/Console/ConfigurationResolverTest.php

@@ -68,12 +68,12 @@ final class ConfigurationResolverTest extends \PHPUnit_Framework_TestCase
     {
         $this->resolver->setOptions(array(
             'path' => '.',
-            'config-file' => 'config.php_cs',
+            'config' => 'config.php_cs',
         ));
         $property = AccessibleObject::create($this->resolver)->options;
 
         $this->assertSame('.', $property['path']);
-        $this->assertSame('config.php_cs', $property['config-file']);
+        $this->assertSame('config.php_cs', $property['config']);
     }
 
     public function testCwd()
@@ -168,7 +168,7 @@ final class ConfigurationResolverTest extends \PHPUnit_Framework_TestCase
         $file = __DIR__.'/../Fixtures/ConfigurationResolverConfigFile/case_4/my.php_cs';
 
         $this->resolver
-            ->setOption('config-file', $file)
+            ->setOption('config', $file)
             ->resolve();
 
         $this->assertSame($file, $this->resolver->getConfigFile());