@@ -50,6 +50,12 @@ protected function configure()
5050 'Run as if this was started in <working-dir> instead of the current working directory ' ,
5151 getcwd ()
5252 ),
53+ new InputOption (
54+ 'fix ' ,
55+ 'f ' ,
56+ InputOption::VALUE_NONE ,
57+ 'Automatically fix all the fixable violations '
58+ )
5359 ])
5460 ->addArgument (
5561 'paths ' ,
@@ -69,10 +75,11 @@ protected function configure()
6975 */
7076 protected function execute (InputInterface $ input , OutputInterface $ output )
7177 {
72- $ paths = $ input ->getArgument ('paths ' );
73- $ exclude = $ input ->getOption ('exclude ' );
74- $ level = $ input ->getOption ('level ' );
78+ $ paths = $ input ->getArgument ('paths ' );
79+ $ exclude = $ input ->getOption ('exclude ' );
80+ $ level = $ input ->getOption ('level ' );
7581 $ currentDir = $ input ->getOption ('working-dir ' );
82+ $ fix = $ input ->getOption ('fix ' );
7683
7784 $ config = new Config ([
7885 'paths ' => $ paths ,
@@ -87,7 +94,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8794 // Execute the linter.
8895 $ twig = new StubbedEnvironment ();
8996 $ linter = new Linter ($ twig , new Tokenizer ($ twig ));
90- $ report = $ linter ->run ($ config ->findFiles (), $ ruleset );
97+ $ report = $ linter ->run ($ config ->findFiles (), $ ruleset, $ fix );
9198
9299 // Format the output.
93100 $ reporter = new TextFormatter ($ input , $ output );
0 commit comments