protected function fix($directory)
    {
        if (!class_exists('PhpCsFixer\Config')) {
            return;
        }

        /** @var Config $fixerConfig */
        $fixerConfig = $this->fixerConfig;

        if (null === $fixerConfig) {
            $fixerConfig = Config::create()
                ->setRiskyAllowed(true)
                ->setRules(
                    array(
                        '@Symfony' => true,
                        'array_syntax' => array('syntax' => 'short'),
                        'simplified_null_return' => false,
                        'ordered_imports' => true,
                        'phpdoc_order' => true,
                        'binary_operator_spaces' => array('align_equals'=>true),
                        'concat_space' => false,
                        'yoda_style' => false,
                        'header_comment' => [
                            'header' => <<<EOH
This file has been auto generated by Jane,

Do no edit it directly.
EOH
                            ,
                        ]
                    )
                );
        }
        $resolverOptions = array('allow-risky' => true);
        $resolver = new ConfigurationResolver($fixerConfig, $resolverOptions, $directory, new ToolInfo());

        $finder = new Finder();
        $finder->in($directory);
        $fixerConfig->setFinder($finder);

        $runner = new Runner(
            $resolver->getConfig()->getFinder(),
            $resolver->getFixers(),
            new NullDiffer(),
            null,
            new ErrorsManager(),
            new Linter(),
            false,
            new NullCacheManager()
        );

        return $runner->fix();
    }
protected function fix($directory)
    {
        if (!class_exists('PhpCsFixer\Config')) {
            return;
        }

        /** @var Config $fixerConfig */
        $fixerConfig = $this->fixerConfig;

        if (null === $fixerConfig) {
            $fixerConfig = Config::create()
                ->setRiskyAllowed(true)
                ->setRules(
                    array(
                        '@Symfony' => true,
                        'array_syntax' => array('syntax' => 'short'),
                        'simplified_null_return' => false,
                        'ordered_imports' => true,
                        'phpdoc_order' => true,
                        'binary_operator_spaces' => array('align_equals'=>true),
                        'concat_space' => false,
                        'yoda_style' => false,
                        'header_comment' => [
                            'header' => <<<EOH
This file has been auto generated by Jane,

Do no edit it directly.
EOH
                            ,
                        ]
                    )
                );
        }
        $resolverOptions = array('allow-risky' => true);
        $resolver = new ConfigurationResolver($fixerConfig, $resolverOptions, $directory, new ToolInfo());

        $finder = new Finder();
        $finder->in($directory);
        $fixerConfig->setFinder($finder);

        $runner = new Runner(
            $resolver->getConfig()->getFinder(),
            $resolver->getFixers(),
            new NullDiffer(),
            null,
            new ErrorsManager(),
            new Linter(),
            false,
            new NullCacheManager()
        );

        return $runner->fix();
    }
protected function fix ( $ directory ) { if ( ! class_exists ( 'PhpCsFixer\Config' ) ) { return ; } /** @var Config $fixerConfig */ $ fixerConfig = $ this -> fixerConfig ; if ( null === $ fixerConfig ) { $ fixerConfig = Config :: create ( ) -> setRiskyAllowed ( true ) -> setRules ( array ( '@Symfony' => true , 'array_syntax' => array ( 'syntax' => 'short' ) , 'simplified_null_return' => false , 'ordered_imports' => true , 'phpdoc_order' => true , 'binary_operator_spaces' => array ( 'align_equals' => true ) , 'concat_space' => false , 'yoda_style' => false , 'header_comment' => [ 'header' =>  <<<EOH
This file has been auto generated by Jane,

Do no edit it directly.
EOH , ] ) ) ; } $ resolverOptions = array ( 'allow-risky' => true ) ; $ resolver = new ConfigurationResolver ( $ fixerConfig , $ resolverOptions , $ directory , new ToolInfo ( ) ) ; $ finder = new Finder ( ) ; $ finder -> in ( $ directory ) ; $ fixerConfig -> setFinder ( $ finder ) ; $ runner = new Runner ( $ resolver -> getConfig ( ) -> getFinder ( ) , $ resolver -> getFixers ( ) , new NullDiffer ( ) , null , new ErrorsManager ( ) , new Linter ( ) , false , new NullCacheManager ( ) ) ; return $ runner -> fix ( ) ; }
Use php cs fixer to have a nice formatting of generated files

@param string $directory

@return array|void
Use php cs fixer to have a nice formatting of generated files