Browse Source

add support for .php_cs.dist file

Dariusz Rumiński 10 years ago
parent
commit
8aebc4b4fd

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
+.php_cs
 composer.lock
 vendor
 phpunit.xml

+ 0 - 0
.php_cs → .php_cs.dist


+ 7 - 5
README.rst

@@ -430,11 +430,13 @@ fixed but without actually modifying them:
     php php-cs-fixer.phar fix /path/to/code --dry-run
 
 Instead of using command line options to customize the fixer, you can save the
-configuration in a ``.php_cs`` file in the root directory of
-your project. The file must return an instance of
-``Symfony\CS\ConfigInterface``, which lets you configure the fixers, the level, the files,
-and directories that need to be analyzed. The example below will add two contrib fixers
-to the default list of PSR2-level fixers:
+project configuration in a ``.php_cs.dist`` file in the root directory
+of your project. The file must return an instance of ``Symfony\CS\ConfigInterface``,
+which lets you configure the fixers, the level, 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.
+The example below will add two contrib fixers to the default list of PSR2-level fixers:
 
 .. code-block:: php
 

+ 0 - 187
Symfony/CS/ConfigurationResolver.php

@@ -1,187 +0,0 @@
-<?php
-
-/*
- * This file is part of the PHP CS utility.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
-
-namespace Symfony\CS;
-
-/**
- * The resolver that resolves configuration to use by command line options and config.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- * @author Katsuhiro Ogawa <ko.fivestar@gmail.com>
- * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
- *
- * @internal
- */
-class ConfigurationResolver
-{
-    protected $allFixers;
-    protected $config;
-    protected $fixers = array();
-    protected $options = array(
-        'fixers'   => null,
-        'level'    => null,
-        'progress' => null,
-    );
-
-    public function setAllFixers(array $allFixers)
-    {
-        $this->allFixers = $allFixers;
-
-        return $this;
-    }
-
-    public function setConfig(ConfigInterface $config)
-    {
-        $this->config = $config;
-
-        return $this;
-    }
-
-    public function setOption($name, $value)
-    {
-        $this->options[$name] = $value;
-
-        return $this;
-    }
-
-    public function setOptions(array $options)
-    {
-        foreach ($options as $name => $value) {
-            $this->setOption($name, $value);
-        }
-
-        return $this;
-    }
-
-    /**
-     * Resolves fixers.
-     *
-     * @return ConfigurationResolver
-     */
-    public function resolve()
-    {
-        $this->resolveByLevel();
-        $this->resolveByNames();
-
-        return $this;
-    }
-
-    /**
-     * Returns fixers.
-     *
-     * @return FixerInterface[] An array of FixerInterface
-     */
-    public function getFixers()
-    {
-        return $this->fixers;
-    }
-
-    public function getProgress()
-    {
-        return $this->options['progress'] && !$this->config->getHideProgress();
-    }
-
-    protected function resolveByLevel()
-    {
-        $level = $this->parseLevel();
-
-        if (null === $level) {
-            return;
-        }
-
-        $fixers = array();
-
-        foreach ($this->allFixers as $fixer) {
-            if ($fixer->getLevel() === ($fixer->getLevel() & $level)) {
-                $fixers[] = $fixer;
-            }
-        }
-
-        $this->fixers = $fixers;
-    }
-
-    protected function resolveByNames()
-    {
-        $names = $this->parseFixers();
-
-        if (null === $names) {
-            return;
-        }
-
-        $addNames = array();
-        $removeNames = array();
-        foreach ($names as $name) {
-            if (0 === strpos($name, '-')) {
-                $removeNames[ltrim($name, '-')] = true;
-            } else {
-                $addNames[$name] = true;
-            }
-        }
-
-        foreach ($this->fixers as $key => $fixer) {
-            if (isset($removeNames[$fixer->getName()])) {
-                unset($this->fixers[$key]);
-            }
-        }
-
-        foreach ($this->allFixers as $fixer) {
-            if (isset($addNames[$fixer->getName()]) && !in_array($fixer, $this->fixers, true)) {
-                $this->fixers[] = $fixer;
-            }
-        }
-    }
-
-    protected function parseLevel()
-    {
-        static $levelMap = array(
-            'none'    => FixerInterface::NONE_LEVEL,
-            'psr0'    => FixerInterface::PSR0_LEVEL,
-            'psr1'    => FixerInterface::PSR1_LEVEL,
-            'psr2'    => FixerInterface::PSR2_LEVEL,
-            'symfony' => FixerInterface::SYMFONY_LEVEL,
-        );
-
-        $levelOption = $this->options['level'];
-
-        if (null !== $levelOption) {
-            if (!isset($levelMap[$levelOption])) {
-                throw new \InvalidArgumentException(sprintf('The level "%s" is not defined.', $levelOption));
-            }
-
-            return $levelMap[$levelOption];
-        }
-
-        if (null === $this->options['fixers']) {
-            return $this->config->getLevel();
-        }
-
-        foreach ($this->parseFixers() as $fixer) {
-            if (0 === strpos($fixer, '-')) {
-                return $this->config->getLevel();
-            }
-        }
-
-        return;
-    }
-
-    protected function parseFixers()
-    {
-        if (null !== $this->options['fixers']) {
-            return array_map('trim', explode(',', $this->options['fixers']));
-        }
-
-        if (null === $this->options['level']) {
-            return $this->config->getFixers();
-        }
-
-        return;
-    }
-}

+ 31 - 85
Symfony/CS/Console/Command/FixCommand.php

@@ -17,17 +17,15 @@ use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\EventDispatcher\EventDispatcher;
-use Symfony\Component\Filesystem\Filesystem;
 use Symfony\Component\Stopwatch\Stopwatch;
 use Symfony\CS\Config\Config;
 use Symfony\CS\ConfigInterface;
-use Symfony\CS\ConfigurationResolver;
+use Symfony\CS\Console\ConfigurationResolver;
 use Symfony\CS\ErrorsManager;
 use Symfony\CS\Fixer;
 use Symfony\CS\FixerFileProcessedEvent;
 use Symfony\CS\FixerInterface;
 use Symfony\CS\LintManager;
-use Symfony\CS\StdinFileInfo;
 use Symfony\CS\Utils;
 
 /**
@@ -174,11 +172,13 @@ fixed but without actually modifying them:
     <info>php %command.full_name% /path/to/code --dry-run</info>
 
 Instead of using command line options to customize the fixer, you can save the
-configuration in a <comment>.php_cs</comment> file in the root directory of
-your project. The file must return an instance of
-``Symfony\CS\ConfigInterface``, which lets you configure the fixers, the level, the files,
-and directories that need to be analyzed. The example below will add two contrib fixers
-to the default list of PSR2-level fixers:
+project configuration in a <comment>.php_cs.dist</comment> file in the root directory
+of your project. The file must return an instance of ``Symfony\CS\ConfigInterface``,
+which lets you configure the fixers, the level, 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.
+The example below will add two contrib fixers to the default list of PSR2-level fixers:
 
     <?php
 
@@ -272,90 +272,36 @@ EOF
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $path = $input->getArgument('path');
-
-        $stdin = false;
-
-        if ('-' === $path) {
-            $stdin = true;
-
-            // Can't write to STDIN
-            $input->setOption('dry-run', true);
-        }
-
-        if (null !== $path) {
-            $filesystem = new Filesystem();
-            if (!$filesystem->isAbsolutePath($path)) {
-                $path = getcwd().DIRECTORY_SEPARATOR.$path;
-            }
-        }
-
-        $configFile = $input->getOption('config-file');
-        if (null === $configFile) {
-            if (is_file($path) && $dirName = pathinfo($path, PATHINFO_DIRNAME)) {
-                $configDir = $dirName;
-            } elseif ($stdin || null === $path) {
-                $configDir = getcwd();
-                // path is directory
-            } else {
-                $configDir = $path;
-            }
-            $configFile = $configDir.DIRECTORY_SEPARATOR.'.php_cs';
-        }
-
-        if ($input->getOption('config')) {
-            $config = null;
-            foreach ($this->fixer->getConfigs() as $c) {
-                if ($c->getName() === $input->getOption('config')) {
-                    $config = $c;
-                    break;
-                }
-            }
+        $resolver = new ConfigurationResolver();
+        $resolver
+            ->setCwd(getcwd())
+            ->setDefaultConfig($this->defaultConfig)
+            ->setFixer($this->fixer)
+            ->setOptions(array(
+                'config' => $input->getOption('config'),
+                'config-file' => $input->getOption('config-file'),
+                'dry-run' => $input->getOption('dry-run'),
+                'level' => $input->getOption('level'),
+                'fixers' => $input->getOption('fixers'),
+                'path' => $input->getArgument('path'),
+                'progress' => $output->isVerbose() && 'txt' === $input->getOption('format'),
+            ))
+            ->resolve()
+        ;
 
-            if (null === $config) {
-                throw new \InvalidArgumentException(sprintf('The configuration "%s" is not defined', $input->getOption('config')));
-            }
-        } elseif (file_exists($configFile)) {
-            $config = include $configFile;
-            // verify that the config has an instance of Config
-            if (!$config instanceof Config) {
-                throw new \UnexpectedValueException(sprintf('The config file "%s" does not return an instance of Symfony\CS\Config\Config', $configFile));
-            }
+        $config     = $resolver->getConfig();
+        $configFile = $resolver->getConfigFile();
 
-            if ('txt' === $input->getOption('format')) {
-                $output->writeln(sprintf('Loaded config from "%s"', $configFile));
-            }
-        } else {
-            $config = $this->defaultConfig;
+        if ($configFile && 'txt' === $input->getOption('format')) {
+            $output->writeln(sprintf('Loaded config from "%s"', $configFile));
         }
 
+        // register custom fixers from config
+        $this->fixer->registerCustomFixers($config->getCustomFixers());
         if ($config->usingLinter()) {
             $this->fixer->setLintManager(new LintManager());
         }
 
-        if (is_file($path)) {
-            $config->finder(new \ArrayIterator(array(new \SplFileInfo($path))));
-        } elseif ($stdin) {
-            $config->finder(new \ArrayIterator(array(new StdinFileInfo())));
-        } elseif (null !== $path) {
-            $config->setDir($path);
-        }
-
-        // register custom fixers from config
-        $this->fixer->registerCustomFixers($config->getCustomFixers());
-
-        $resolver = new ConfigurationResolver();
-        $resolver
-            ->setAllFixers($this->fixer->getFixers())
-            ->setConfig($config)
-            ->setOptions(array(
-                'level'     => $input->getOption('level'),
-                'fixers'    => $input->getOption('fixers'),
-                'progress'  => $output->isVerbose() && 'txt' === $input->getOption('format'),
-            ))
-            ->resolve();
-
-        $config->fixers($resolver->getFixers());
         $showProgress = $resolver->getProgress();
 
         if ($showProgress) {
@@ -368,7 +314,7 @@ EOF
         }
 
         $this->stopwatch->start('fixFiles');
-        $changed = $this->fixer->fix($config, $input->getOption('dry-run'), $input->getOption('diff'));
+        $changed = $this->fixer->fix($config, $resolver->isDryRun(), $input->getOption('diff'));
         $this->stopwatch->stop('fixFiles');
 
         if ($showProgress) {

+ 457 - 0
Symfony/CS/Console/ConfigurationResolver.php

@@ -0,0 +1,457 @@
+<?php
+
+/*
+ * This file is part of the PHP CS utility.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\CS\Console;
+
+use Symfony\Component\Filesystem\Filesystem;
+use Symfony\CS\Config\Config;
+use Symfony\CS\ConfigInterface;
+use Symfony\CS\Fixer;
+use Symfony\CS\FixerInterface;
+use Symfony\CS\StdinFileInfo;
+
+/**
+ * The resolver that resolves configuration to use by command line options and config.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ * @author Katsuhiro Ogawa <ko.fivestar@gmail.com>
+ * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
+ *
+ * @internal
+ */
+class ConfigurationResolver
+{
+    private $allFixers;
+    private $config;
+    private $configFile;
+    private $cwd;
+    private $defaultConfig;
+    private $isStdIn;
+    private $isDryRun;
+    private $fixer;
+    private $fixers = array();
+    private $options = array(
+        'config' => null,
+        'config-file' => null,
+        'dry-run' => null,
+        'fixers' => null,
+        'level' => null,
+        'path' => null,
+        'progress' => null,
+    );
+    private $path;
+    private $progress;
+
+    /**
+     * Returns config instance.
+     *
+     * @return ConfigInterface
+     */
+    public function getConfig()
+    {
+        return $this->config;
+    }
+
+    /**
+     * Returns config file path.
+     *
+     * @return string
+     */
+    public function getConfigFile()
+    {
+        return $this->configFile;
+    }
+
+    /**
+     * Returns fixers.
+     *
+     * @return FixerInterface[] An array of FixerInterface
+     */
+    public function getFixers()
+    {
+        return $this->fixers;
+    }
+
+    /**
+     * Returns path.
+     *
+     * @return string
+     */
+    public function getPath()
+    {
+        return $this->path;
+    }
+
+    /**
+     * Returns progress flag.
+     *
+     * @return bool
+     */
+    public function getProgress()
+    {
+        return $this->progress;
+    }
+
+    /**
+     * Returns dry-run flag.
+     *
+     * @return bool
+     */
+    public function isDryRun()
+    {
+        return $this->isDryRun;
+    }
+
+    /**
+     * Resolve configuration.
+     *
+     * @return ConfigurationResolver
+     */
+    public function resolve()
+    {
+        $this->resolvePath();
+        $this->resolveIsStdIn();
+        $this->resolveIsDryRun();
+
+        $this->resolveConfig();
+        $this->resolveConfigPath();
+
+        $this->resolveFixersByLevel();
+        $this->resolveFixersByNames();
+
+        $this->resolveProgress();
+
+        $this->config->fixers($this->getFixers());
+
+        return $this;
+    }
+
+    /**
+     * Set current working directory.
+     *
+     * @param string $cwd
+     *
+     * @return FixersResolver
+     */
+    public function setCwd($cwd)
+    {
+        $this->cwd = $cwd;
+
+        return $this;
+    }
+
+    /**
+     * Set default config instance.
+     *
+     * @param ConfigInterface $config
+     *
+     * @return FixersResolver
+     */
+    public function setDefaultConfig(ConfigInterface $config)
+    {
+        $this->defaultConfig = $config;
+
+        return $this;
+    }
+
+    /**
+     * Set fixer instance.
+     *
+     * @param Fixer $config
+     *
+     * @return FixersResolver
+     */
+    public function setFixer(Fixer $fixer)
+    {
+        $this->fixer     = $fixer;
+        $this->allFixers = $fixer->getFixers();
+
+        return $this;
+    }
+
+    /**
+     * Set option that will be resolved.
+     *
+     * @param string $name
+     * @param misc   $value1
+     *
+     * @return FixersResolver
+     */
+    public function setOption($name, $value)
+    {
+        if (!array_key_exists($name, $this->options)) {
+            throw new \OutOfBoundsException('Unknown option name: '.$name);
+        }
+
+        $this->options[$name] = $value;
+
+        return $this;
+    }
+
+    /**
+     * Set options that will be resolved.
+     *
+     * @param array $options
+     *
+     * @return FixersResolver
+     */
+    public function setOptions(array $options)
+    {
+        foreach ($options as $name => $value) {
+            $this->setOption($name, $value);
+        }
+
+        return $this;
+    }
+
+    /**
+     * Compute file candidates for config file.
+     *
+     * @return string[]
+     */
+    private function computeConfigFiles()
+    {
+        $configFile = $this->options['config-file'];
+        $path = $this->path;
+
+        if (null !== $configFile) {
+            return array($configFile);
+        }
+
+        if (is_file($path) && $dirName = pathinfo($path, PATHINFO_DIRNAME)) {
+            $configDir = $dirName;
+        } elseif ($this->isStdIn || null === $path) {
+            $configDir = $this->cwd;
+            // path is directory
+        } else {
+            $configDir = $path;
+        }
+
+        return array(
+            $configDir.DIRECTORY_SEPARATOR.'.php_cs',
+            $configDir.DIRECTORY_SEPARATOR.'.php_cs.dist',
+        );
+    }
+
+    /**
+     * Compute fixers.
+     *
+     * @return string[]|null
+     */
+    private function parseFixers()
+    {
+        if (null !== $this->options['fixers']) {
+            return array_map('trim', explode(',', $this->options['fixers']));
+        }
+
+        if (null === $this->options['level']) {
+            return $this->config->getFixers();
+        }
+
+        return;
+    }
+
+    /**
+     * Compute level.
+     *
+     * @return string|null
+     */
+    private function parseLevel()
+    {
+        static $levelMap = array(
+            'none'    => FixerInterface::NONE_LEVEL,
+            'psr0'    => FixerInterface::PSR0_LEVEL,
+            'psr1'    => FixerInterface::PSR1_LEVEL,
+            'psr2'    => FixerInterface::PSR2_LEVEL,
+            'symfony' => FixerInterface::SYMFONY_LEVEL,
+        );
+
+        $levelOption = $this->options['level'];
+
+        if (null !== $levelOption) {
+            if (!isset($levelMap[$levelOption])) {
+                throw new \InvalidArgumentException(sprintf('The level "%s" is not defined.', $levelOption));
+            }
+
+            return $levelMap[$levelOption];
+        }
+
+        if (null === $this->options['fixers']) {
+            return $this->config->getLevel();
+        }
+
+        foreach ($this->parseFixers() as $fixer) {
+            if (0 === strpos($fixer, '-')) {
+                return $this->config->getLevel();
+            }
+        }
+
+        return;
+    }
+
+    /**
+     * Resolve config based on options: config, config-file.
+     */
+    private function resolveConfig()
+    {
+        $configOption = $this->options['config'];
+
+        if ($configOption) {
+            foreach ($this->fixer->getConfigs() as $c) {
+                if ($c->getName() === $configOption) {
+                    $this->config = $c;
+
+                    return;
+                }
+            }
+
+            if (null === $this->config) {
+                throw new \InvalidArgumentException(sprintf('The configuration "%s" is not defined', $configOption));
+            }
+        }
+
+        foreach ($this->computeConfigFiles() as $configFile) {
+            if (file_exists($configFile)) {
+                $config = include $configFile;
+
+                // verify that the config has an instance of Config
+                if (!$config instanceof Config) {
+                    throw new \UnexpectedValueException(sprintf('The config file "%s" does not return an instance of Symfony\CS\Config\Config', $configFile));
+                }
+
+                $this->config     = $config;
+                $this->configFile = $configFile;
+
+                return;
+            }
+        }
+
+        $this->config = $this->defaultConfig;
+    }
+
+    /**
+     * Apply path on config instance.
+     */
+    private function resolveConfigPath()
+    {
+        if (is_file($this->path)) {
+            $this->config->finder(new \ArrayIterator(array(new \SplFileInfo($this->path))));
+        } elseif ($this->isStdIn) {
+            $this->config->finder(new \ArrayIterator(array(new StdinFileInfo())));
+        } elseif (null !== $this->path) {
+            $this->config->setDir($this->path);
+        }
+    }
+
+    /**
+     * Resolve fixers to run based on level.
+     */
+    private function resolveFixersByLevel()
+    {
+        $level = $this->parseLevel();
+
+        if (null === $level) {
+            return;
+        }
+
+        $fixers = array();
+
+        foreach ($this->allFixers as $fixer) {
+            if ($fixer->getLevel() === ($fixer->getLevel() & $level)) {
+                $fixers[] = $fixer;
+            }
+        }
+
+        $this->fixers = $fixers;
+    }
+
+    /**
+     * Resolve fixers to run based on names.
+     */
+    private function resolveFixersByNames()
+    {
+        $names = $this->parseFixers();
+
+        if (null === $names) {
+            return;
+        }
+
+        $addNames = array();
+        $removeNames = array();
+        foreach ($names as $name) {
+            if (0 === strpos($name, '-')) {
+                $removeNames[ltrim($name, '-')] = true;
+            } else {
+                $addNames[$name] = true;
+            }
+        }
+
+        foreach ($this->fixers as $key => $fixer) {
+            if (isset($removeNames[$fixer->getName()])) {
+                unset($this->fixers[$key]);
+            }
+        }
+
+        foreach ($this->allFixers as $fixer) {
+            if (isset($addNames[$fixer->getName()]) && !in_array($fixer, $this->fixers, true)) {
+                $this->fixers[] = $fixer;
+            }
+        }
+    }
+
+    /**
+     * Resolve isDryRun based on isStdIn property and dry-run option.
+     */
+    private function resolveIsDryRun()
+    {
+        // Can't write to STDIN
+        if ($this->isStdIn) {
+            $this->isDryRun = true;
+
+            return;
+        }
+
+        $this->isDryRun = $this->options['dry-run'];
+    }
+
+    /**
+     * Resolve isStdIn based on path option.
+     */
+    private function resolveIsStdIn()
+    {
+        $this->isStdIn = '-' === $this->options['path'];
+    }
+
+    /**
+     * Resolve path based on path option.
+     */
+    private function resolvePath()
+    {
+        $path = $this->options['path'];
+
+        if (null !== $path) {
+            $filesystem = new Filesystem();
+            if (!$filesystem->isAbsolutePath($path)) {
+                $path = $this->cwd.DIRECTORY_SEPARATOR.$path;
+            }
+        }
+
+        $this->path = $path;
+    }
+
+    /**
+     * Resolve progress based on progress option and config instance.
+     */
+    private function resolveProgress()
+    {
+        $this->progress = $this->options['progress'] && !$this->config->getHideProgress();
+    }
+}

+ 0 - 265
Symfony/CS/Tests/ConfigurationResolverTest.php

@@ -1,265 +0,0 @@
-<?php
-
-/*
- * This file is part of the PHP CS utility.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
-
-namespace Symfony\CS\Tests;
-
-use Symfony\CS\Config\Config;
-use Symfony\CS\ConfigurationResolver;
-use Symfony\CS\Fixer;
-use Symfony\CS\FixerInterface;
-
-/**
- * @author Katsuhiro Ogawa <ko.fivestar@gmail.com>
- * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
- */
-class ConfigurationResolverTest extends \PHPUnit_Framework_TestCase
-{
-    protected $config;
-    protected $resolver;
-    protected $fixersMap;
-
-    protected function setUp()
-    {
-        $fixer = new Fixer();
-        $fixer->registerBuiltInFixers();
-        $fixer->registerBuiltInConfigs();
-
-        $fixersMap = array();
-
-        foreach ($fixer->getFixers() as $singleFixer) {
-            $level = $singleFixer->getLevel();
-
-            if (!isset($fixersMap[$level])) {
-                $fixersMap[$level] = array();
-            }
-
-            $fixersMap[$level][$singleFixer->getName()] = $singleFixer;
-        }
-
-        $this->fixersMap = $fixersMap;
-
-        $this->config = new Config();
-        $this->resolver = new ConfigurationResolver();
-        $this->resolver
-            ->setAllFixers($fixer->getFixers())
-            ->setConfig($this->config);
-    }
-
-    protected function makeFixersTest($expectedFixers, $resolvedFixers)
-    {
-        $this->assertCount(count($expectedFixers), $resolvedFixers);
-
-        foreach ($expectedFixers as $fixer) {
-            $this->assertContains($fixer, $resolvedFixers);
-        }
-    }
-
-    public function testResolveFixersReturnsEmptyArrayByDefault()
-    {
-        $this->makeFixersTest(array(), $this->resolver->getFixers());
-    }
-
-    public function testResolveFixersWithLevelConfig()
-    {
-        $this->config->level(FixerInterface::PSR1_LEVEL);
-
-        $this->resolver->resolve();
-
-        $this->makeFixersTest(
-            array_merge($this->fixersMap[FixerInterface::PSR0_LEVEL], $this->fixersMap[FixerInterface::PSR1_LEVEL]),
-            $this->resolver->getFixers()
-        );
-    }
-
-    public function testResolveFixersWithPositiveFixersConfig()
-    {
-        $this->config->level(FixerInterface::SYMFONY_LEVEL);
-        $this->config->fixers(array('strict', 'strict_param'));
-
-        $this->resolver->resolve();
-
-        $expectedFixers = array_merge(
-            $this->fixersMap[FixerInterface::PSR0_LEVEL],
-            $this->fixersMap[FixerInterface::PSR1_LEVEL],
-            $this->fixersMap[FixerInterface::PSR2_LEVEL],
-            $this->fixersMap[FixerInterface::SYMFONY_LEVEL],
-            array($this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict'], $this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict_param'])
-        );
-
-        $this->makeFixersTest(
-            $expectedFixers,
-            $this->resolver->getFixers()
-        );
-    }
-
-    public function testResolveFixersWithNegativeFixersConfig()
-    {
-        $this->config->level(FixerInterface::SYMFONY_LEVEL);
-        $this->config->fixers(array('strict', '-include', 'strict_param'));
-
-        $this->resolver->resolve();
-
-        $expectedFixers = array_merge(
-            $this->fixersMap[FixerInterface::PSR0_LEVEL],
-            $this->fixersMap[FixerInterface::PSR1_LEVEL],
-            $this->fixersMap[FixerInterface::PSR2_LEVEL],
-            $this->fixersMap[FixerInterface::SYMFONY_LEVEL],
-            array($this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict'], $this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict_param'])
-        );
-
-        foreach ($expectedFixers as $key => $fixer) {
-            if ($fixer->getName() === 'include') {
-                unset($expectedFixers[$key]);
-                break;
-            }
-        }
-
-        $this->makeFixersTest(
-            $expectedFixers,
-            $this->resolver->getFixers()
-        );
-    }
-
-    public function testResolveFixersWithLevelOption()
-    {
-        $this->resolver
-            ->setOption('level', 'psr1')
-            ->resolve();
-
-        $this->makeFixersTest(
-            array_merge($this->fixersMap[FixerInterface::PSR0_LEVEL], $this->fixersMap[FixerInterface::PSR1_LEVEL]),
-            $this->resolver->getFixers()
-        );
-    }
-
-    public function testResolveFixersWithLevelConfigAndFixersConfigAndLevelOption()
-    {
-        $this->config
-            ->level(FixerInterface::PSR2_LEVEL)
-            ->fixers(array('strict'));
-        $this->resolver
-            ->setOption('level', 'psr1')
-            ->resolve();
-
-        $this->makeFixersTest(
-            array_merge($this->fixersMap[FixerInterface::PSR0_LEVEL], $this->fixersMap[FixerInterface::PSR1_LEVEL]),
-            $this->resolver->getFixers()
-        );
-    }
-
-    public function testResolveFixersWithLevelConfigAndFixersConfigAndPositiveFixersOption()
-    {
-        $this->config
-            ->level(FixerInterface::PSR2_LEVEL)
-            ->fixers(array('strict'));
-        $this->resolver
-            ->setOption('fixers', 'psr0')
-            ->resolve();
-
-        $this->makeFixersTest(
-            array($this->fixersMap[FixerInterface::PSR0_LEVEL]['psr0']),
-            $this->resolver->getFixers()
-        );
-    }
-
-    public function testResolveFixersWithLevelConfigAndFixersConfigAndNegativeFixersOption()
-    {
-        $this->config
-            ->level(FixerInterface::SYMFONY_LEVEL)
-            ->fixers(array('strict'));
-        $this->resolver
-            ->setOption('fixers', 'strict, -include,strict_param ')
-            ->resolve();
-
-        $expectedFixers = array_merge(
-            $this->fixersMap[FixerInterface::PSR0_LEVEL],
-            $this->fixersMap[FixerInterface::PSR1_LEVEL],
-            $this->fixersMap[FixerInterface::PSR2_LEVEL],
-            $this->fixersMap[FixerInterface::SYMFONY_LEVEL],
-            array($this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict'], $this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict_param'])
-        );
-
-        foreach ($expectedFixers as $key => $fixer) {
-            if ($fixer->getName() === 'include') {
-                unset($expectedFixers[$key]);
-                break;
-            }
-        }
-
-        $this->makeFixersTest(
-            $expectedFixers,
-            $this->resolver->getFixers()
-        );
-    }
-
-    public function testResolveFixersWithLevelConfigAndFixersConfigAndLevelOptionsAndFixersOption()
-    {
-        $this->config
-            ->level(FixerInterface::PSR2_LEVEL)
-            ->fixers(array('concat_with_spaces'));
-        $this->resolver
-            ->setOption('level', 'symfony')
-            ->setOption('fixers', 'strict, -include,strict_param ')
-            ->resolve();
-
-        $expectedFixers = array_merge(
-            $this->fixersMap[FixerInterface::PSR0_LEVEL],
-            $this->fixersMap[FixerInterface::PSR1_LEVEL],
-            $this->fixersMap[FixerInterface::PSR2_LEVEL],
-            $this->fixersMap[FixerInterface::SYMFONY_LEVEL],
-            array($this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict'], $this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict_param'])
-        );
-
-        foreach ($expectedFixers as $key => $fixer) {
-            if ($fixer->getName() === 'include') {
-                unset($expectedFixers[$key]);
-                break;
-            }
-        }
-
-        $this->makeFixersTest(
-            $expectedFixers,
-            $this->resolver->getFixers()
-        );
-    }
-
-    public function testResolveProgressWithPositiveConfigAndPositiveOption()
-    {
-        $this->config->hideProgress(true);
-        $this->resolver->setOption('progress', true);
-
-        $this->assertFalse($this->resolver->getProgress());
-    }
-
-    public function testResolveProgressWithPositiveConfigAndNegativeOption()
-    {
-        $this->config->hideProgress(true);
-        $this->resolver->setOption('progress', false);
-
-        $this->assertFalse($this->resolver->getProgress());
-    }
-
-    public function testResolveProgressWithNegativeConfigAndPositiveOption()
-    {
-        $this->config->hideProgress(false);
-        $this->resolver->setOption('progress', true);
-
-        $this->assertTrue($this->resolver->getProgress());
-    }
-
-    public function testResolveProgressWithNegativeConfigAndNegativeOption()
-    {
-        $this->config->hideProgress(false);
-        $this->resolver->setOption('progress', false);
-
-        $this->assertFalse($this->resolver->getProgress());
-    }
-}

+ 511 - 0
Symfony/CS/Tests/Console/ConfigurationResolverTest.php

@@ -0,0 +1,511 @@
+<?php
+
+/*
+ * This file is part of the PHP CS utility.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\CS\Tests\Console;
+
+use Symfony\CS\Config\Config;
+use Symfony\CS\Console\ConfigurationResolver;
+use Symfony\CS\Fixer;
+use Symfony\CS\FixerInterface;
+
+/**
+ * @author Katsuhiro Ogawa <ko.fivestar@gmail.com>
+ * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
+ */
+class ConfigurationResolverTest extends \PHPUnit_Framework_TestCase
+{
+    protected $config;
+    protected $resolver;
+    protected $fixersMap;
+
+    protected function setUp()
+    {
+        $fixer = new Fixer();
+        $fixer->registerBuiltInFixers();
+        $fixer->registerBuiltInConfigs();
+
+        $fixersMap = array();
+
+        foreach ($fixer->getFixers() as $singleFixer) {
+            $level = $singleFixer->getLevel();
+
+            if (!isset($fixersMap[$level])) {
+                $fixersMap[$level] = array();
+            }
+
+            $fixersMap[$level][$singleFixer->getName()] = $singleFixer;
+        }
+
+        $this->fixersMap = $fixersMap;
+
+        $this->config = new Config();
+        $this->resolver = new ConfigurationResolver();
+        $this->resolver
+            ->setDefaultConfig($this->config)
+            ->setFixer($fixer)
+        ;
+    }
+
+    protected function tearDown()
+    {
+        unset(
+            $this->fixersMap,
+            $this->config,
+            $this->resolver
+        );
+    }
+
+    public function testSetOption()
+    {
+        $this->resolver->setOption('path', '.');
+
+        $classReflection = new \ReflectionClass($this->resolver);
+        $propertyReflection = $classReflection->getProperty('options');
+        $propertyReflection->setAccessible(true);
+        $property = $propertyReflection->getValue($this->resolver);
+
+        $this->assertSame('.', $property['path']);
+    }
+
+    /**
+     * @expectedException               OutOfBoundsException
+     * @expectedExceptionMessageRegExp  /Unknown option name: foo/
+     */
+    public function testSetOptionWithUndefinedOption()
+    {
+        $this->resolver->setOption('foo', 'bar');
+    }
+
+    public function testSetOptions()
+    {
+        $this->resolver->setOptions(array(
+            'path' => '.',
+            'config-file' => 'config.php_cs',
+        ));
+
+        $classReflection = new \ReflectionClass($this->resolver);
+        $propertyReflection = $classReflection->getProperty('options');
+        $propertyReflection->setAccessible(true);
+        $property = $propertyReflection->getValue($this->resolver);
+
+        $this->assertSame('.', $property['path']);
+        $this->assertSame('config.php_cs', $property['config-file']);
+    }
+
+    public function testCwd()
+    {
+        $this->resolver->setCwd("foo");
+
+        $classReflection = new \ReflectionClass($this->resolver);
+        $propertyReflection = $classReflection->getProperty('cwd');
+        $propertyReflection->setAccessible(true);
+        $property = $propertyReflection->getValue($this->resolver);
+
+        $this->assertSame("foo", $property);
+    }
+
+    protected function makeFixersTest($expectedFixers, $resolvedFixers)
+    {
+        $this->assertCount(count($expectedFixers), $resolvedFixers);
+
+        foreach ($expectedFixers as $fixer) {
+            $this->assertContains($fixer, $resolvedFixers);
+        }
+    }
+
+    public function testResolveFixersReturnsEmptyArrayByDefault()
+    {
+        $this->makeFixersTest(array(), $this->resolver->getFixers());
+    }
+
+    public function testResolveFixersWithLevelConfig()
+    {
+        $this->config->level(FixerInterface::PSR1_LEVEL);
+
+        $this->resolver->resolve();
+
+        $this->makeFixersTest(
+            array_merge($this->fixersMap[FixerInterface::PSR0_LEVEL], $this->fixersMap[FixerInterface::PSR1_LEVEL]),
+            $this->resolver->getFixers()
+        );
+    }
+
+    public function testResolveFixersWithPositiveFixersConfig()
+    {
+        $this->config->level(FixerInterface::SYMFONY_LEVEL);
+        $this->config->fixers(array('strict', 'strict_param'));
+
+        $this->resolver->resolve();
+
+        $expectedFixers = array_merge(
+            $this->fixersMap[FixerInterface::PSR0_LEVEL],
+            $this->fixersMap[FixerInterface::PSR1_LEVEL],
+            $this->fixersMap[FixerInterface::PSR2_LEVEL],
+            $this->fixersMap[FixerInterface::SYMFONY_LEVEL],
+            array($this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict'], $this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict_param'])
+        );
+
+        $this->makeFixersTest(
+            $expectedFixers,
+            $this->resolver->getFixers()
+        );
+    }
+
+    public function testResolveFixersWithNegativeFixersConfig()
+    {
+        $this->config->level(FixerInterface::SYMFONY_LEVEL);
+        $this->config->fixers(array('strict', '-include', 'strict_param'));
+
+        $this->resolver->resolve();
+
+        $expectedFixers = array_merge(
+            $this->fixersMap[FixerInterface::PSR0_LEVEL],
+            $this->fixersMap[FixerInterface::PSR1_LEVEL],
+            $this->fixersMap[FixerInterface::PSR2_LEVEL],
+            $this->fixersMap[FixerInterface::SYMFONY_LEVEL],
+            array($this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict'], $this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict_param'])
+        );
+
+        foreach ($expectedFixers as $key => $fixer) {
+            if ('include' === $fixer->getName()) {
+                unset($expectedFixers[$key]);
+                break;
+            }
+        }
+
+        $this->makeFixersTest(
+            $expectedFixers,
+            $this->resolver->getFixers()
+        );
+    }
+
+    /**
+     * @expectedException               InvalidArgumentException
+     * @expectedExceptionMessageRegExp  /The level "foo" is not defined./
+     */
+    public function testResolveFixersWithInvalidLevelOption()
+    {
+        $this->resolver
+            ->setOption('level', 'foo')
+            ->resolve()
+        ;
+    }
+
+    public function testResolveFixersWithLevelOption()
+    {
+        $this->resolver
+            ->setOption('level', 'psr1')
+            ->resolve()
+        ;
+
+        $this->makeFixersTest(
+            array_merge($this->fixersMap[FixerInterface::PSR0_LEVEL], $this->fixersMap[FixerInterface::PSR1_LEVEL]),
+            $this->resolver->getFixers()
+        );
+    }
+
+    public function testResolveFixersWithLevelConfigAndFixersConfigAndLevelOption()
+    {
+        $this->config
+            ->level(FixerInterface::PSR2_LEVEL)
+            ->fixers(array('strict'))
+        ;
+        $this->resolver
+            ->setOption('level', 'psr1')
+            ->resolve()
+        ;
+
+        $this->makeFixersTest(
+            array_merge($this->fixersMap[FixerInterface::PSR0_LEVEL], $this->fixersMap[FixerInterface::PSR1_LEVEL]),
+            $this->resolver->getFixers()
+        );
+    }
+
+    public function testResolveFixersWithLevelConfigAndFixersConfigAndPositiveFixersOption()
+    {
+        $this->config
+            ->level(FixerInterface::PSR2_LEVEL)
+            ->fixers(array('strict'))
+        ;
+        $this->resolver
+            ->setOption('fixers', 'psr0')
+            ->resolve()
+        ;
+
+        $this->makeFixersTest(
+            array($this->fixersMap[FixerInterface::PSR0_LEVEL]['psr0']),
+            $this->resolver->getFixers()
+        );
+    }
+
+    public function testResolveFixersWithLevelConfigAndFixersConfigAndNegativeFixersOption()
+    {
+        $this->config
+            ->level(FixerInterface::SYMFONY_LEVEL)
+            ->fixers(array('strict'))
+        ;
+        $this->resolver
+            ->setOption('fixers', 'strict, -include,strict_param ')
+            ->resolve()
+        ;
+
+        $expectedFixers = array_merge(
+            $this->fixersMap[FixerInterface::PSR0_LEVEL],
+            $this->fixersMap[FixerInterface::PSR1_LEVEL],
+            $this->fixersMap[FixerInterface::PSR2_LEVEL],
+            $this->fixersMap[FixerInterface::SYMFONY_LEVEL],
+            array($this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict'], $this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict_param'])
+        );
+
+        foreach ($expectedFixers as $key => $fixer) {
+            if ($fixer->getName() === 'include') {
+                unset($expectedFixers[$key]);
+                break;
+            }
+        }
+
+        $this->makeFixersTest(
+            $expectedFixers,
+            $this->resolver->getFixers()
+        );
+    }
+
+    public function testResolveFixersWithLevelConfigAndFixersConfigAndLevelOptionsAndFixersOption()
+    {
+        $this->config
+            ->level(FixerInterface::PSR2_LEVEL)
+            ->fixers(array('concat_with_spaces'))
+        ;
+        $this->resolver
+            ->setOption('level', 'symfony')
+            ->setOption('fixers', 'strict, -include,strict_param ')
+            ->resolve()
+        ;
+
+        $expectedFixers = array_merge(
+            $this->fixersMap[FixerInterface::PSR0_LEVEL],
+            $this->fixersMap[FixerInterface::PSR1_LEVEL],
+            $this->fixersMap[FixerInterface::PSR2_LEVEL],
+            $this->fixersMap[FixerInterface::SYMFONY_LEVEL],
+            array($this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict'], $this->fixersMap[FixerInterface::CONTRIB_LEVEL]['strict_param'])
+        );
+
+        foreach ($expectedFixers as $key => $fixer) {
+            if ($fixer->getName() === 'include') {
+                unset($expectedFixers[$key]);
+                break;
+            }
+        }
+
+        $this->makeFixersTest(
+            $expectedFixers,
+            $this->resolver->getFixers()
+        );
+    }
+
+    public function testResolveProgressWithPositiveConfigAndPositiveOption()
+    {
+        $this->config->hideProgress(true);
+        $this->resolver
+            ->setOption('progress', true)
+            ->resolve()
+        ;
+
+        $this->assertFalse($this->resolver->getProgress());
+    }
+
+    public function testResolveProgressWithPositiveConfigAndNegativeOption()
+    {
+        $this->config->hideProgress(true);
+        $this->resolver
+            ->setOption('progress', false)
+            ->resolve()
+        ;
+
+        $this->assertFalse($this->resolver->getProgress());
+    }
+
+    public function testResolveProgressWithNegativeConfigAndPositiveOption()
+    {
+        $this->config->hideProgress(false);
+        $this->resolver
+            ->setOption('progress', true)
+            ->resolve()
+        ;
+
+        $this->assertTrue($this->resolver->getProgress());
+    }
+
+    public function testResolveProgressWithNegativeConfigAndNegativeOption()
+    {
+        $this->config->hideProgress(false);
+        $this->resolver
+            ->setOption('progress', false)
+            ->resolve()
+        ;
+
+        $this->assertFalse($this->resolver->getProgress());
+    }
+
+    /**
+     * @dataProvider provideResolveConfigByNameCases
+     */
+    public function testResolveConfigByName($expected, $name)
+    {
+        $this->resolver
+            ->setOption('config', $name)
+            ->resolve()
+        ;
+
+        $this->assertInstanceOf($expected, $this->resolver->getConfig());
+    }
+
+    public function provideResolveConfigByNameCases()
+    {
+        return array(
+            array("\\Symfony\\CS\\Config\\Config", 'default'),
+            array("\\Symfony\\CS\\Config\\MagentoConfig", 'magento'),
+            array("\\Symfony\\CS\\Config\\Symfony23Config", 'sf23'),
+        );
+    }
+
+    /**
+     * @expectedException               InvalidArgumentException
+     * @expectedExceptionMessageRegExp  /The configuration "\w+" is not defined/
+     */
+    public function testResolveConfigByNameThatDoesntExists()
+    {
+        $this->resolver
+            ->setOption('config', 'NON_EXISTING_CONFIG')
+            ->resolve()
+        ;
+    }
+
+    public function testResolveConfigFileDefault()
+    {
+        $this->resolver
+            ->resolve();
+
+        $this->assertNull($this->resolver->getConfigFile());
+        $this->assertInstanceOf("\\Symfony\\CS\\Config\\Config", $this->resolver->getConfig());
+    }
+
+    public function testResolveConfigFileByPathOfFile()
+    {
+        $dir = __DIR__.'/../Fixtures/ConfigurationResolverConfigFile/case_1';
+
+        $this->resolver
+            ->setOption('path', $dir.DIRECTORY_SEPARATOR.'foo.php')
+            ->resolve();
+
+        $this->assertSame($dir.DIRECTORY_SEPARATOR.'.php_cs.dist', $this->resolver->getConfigFile());
+        $this->assertInstanceOf("\\Symfony\\CS\\Config\\MagentoConfig", $this->resolver->getConfig());
+    }
+
+    public function testResolveConfigFileSpecified()
+    {
+        $file = __DIR__.'/../Fixtures/ConfigurationResolverConfigFile/case_4/my.php_cs';
+
+        $this->resolver
+            ->setOption('config-file', $file)
+            ->resolve();
+
+        $this->assertSame($file, $this->resolver->getConfigFile());
+        $this->assertInstanceOf("\\Symfony\\CS\\Config\\MagentoConfig", $this->resolver->getConfig());
+    }
+
+    /**
+     * @dataProvider provideResolveConfigFileDefaultCases
+     */
+    public function testResolveConfigFileChooseFile($expectedFile, $expectedClass, $path)
+    {
+        $this->resolver
+            ->setOption('path', $path)
+            ->resolve();
+
+        $this->assertSame($expectedFile, $this->resolver->getConfigFile());
+        $this->assertInstanceOf($expectedClass, $this->resolver->getConfig());
+    }
+
+    public function provideResolveConfigFileDefaultCases()
+    {
+        $dirBase = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'ConfigurationResolverConfigFile'.DIRECTORY_SEPARATOR;
+
+        return array(
+            array(
+                $dirBase.'case_1'.DIRECTORY_SEPARATOR.'.php_cs.dist',
+                "\\Symfony\\CS\\Config\\MagentoConfig",
+                $dirBase.'case_1',
+            ),
+            array(
+                $dirBase.'case_2'.DIRECTORY_SEPARATOR.'.php_cs',
+                "\\Symfony\\CS\\Config\\MagentoConfig",
+                $dirBase.'case_2',
+            ),
+            array(
+                $dirBase.'case_3'.DIRECTORY_SEPARATOR.'.php_cs',
+                "\\Symfony\\CS\\Config\\MagentoConfig",
+                $dirBase.'case_3',
+            ),
+        );
+    }
+
+    /**
+     * @expectedException               UnexpectedValueException
+     * @expectedExceptionMessageRegExp  /The config file ".*" does not return an instance of Symfony\\CS\\Config\\Config/
+     */
+    public function testResolveConfigFileChooseFileWithInvalidFile()
+    {
+        $dirBase = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'ConfigurationResolverConfigFile'.DIRECTORY_SEPARATOR;
+
+        $this->resolver
+            ->setOption('path', $dirBase.'case_5')
+            ->resolve();
+    }
+
+    public function testResolvePathRelative()
+    {
+        $this->resolver
+            ->setCwd(__DIR__)
+            ->setOption('path', 'Foo'.DIRECTORY_SEPARATOR.'Bar')
+            ->resolve();
+
+        $this->assertSame(__DIR__.DIRECTORY_SEPARATOR.'Foo'.DIRECTORY_SEPARATOR.'Bar', $this->resolver->getPath());
+    }
+
+    public function testResolveIsDryRunViaStdIn()
+    {
+        $this->resolver
+            ->setOption('path', '-')
+            ->setOption('dry-run', false)
+            ->resolve();
+
+        $this->assertTrue($this->resolver->isDryRun());
+    }
+
+    public function testResolveIsDryRunViaNegativeOption()
+    {
+        $this->resolver
+            ->setOption('dry-run', false)
+            ->resolve();
+
+        $this->assertFalse($this->resolver->isDryRun());
+    }
+
+    public function testResolveIsDryRunViaPositiveOption()
+    {
+        $this->resolver
+            ->setOption('dry-run', true)
+            ->resolve();
+
+        $this->assertTrue($this->resolver->isDryRun());
+    }
+}

+ 3 - 0
Symfony/CS/Tests/Fixtures/ConfigurationResolverConfigFile/case_1/.php_cs.dist

@@ -0,0 +1,3 @@
+<?php
+
+return Symfony\CS\Config\MagentoConfig::create();

+ 4 - 0
Symfony/CS/Tests/Fixtures/ConfigurationResolverConfigFile/case_1/foo.php

@@ -0,0 +1,4 @@
+<?php
+
+function bar() {
+}

Some files were not shown because too many files changed in this diff