@@ -88,7 +88,6 @@ protected function configure()
8888 protected function execute (InputInterface $ input , OutputInterface $ output )
8989 {
9090 $ this ->ioStyle = new SymfonyStyle ($ input , $ output );
91- $ this ->parseRulesetJson ();
9291 try {
9392 $ this ->validateInput ($ input );
9493 } catch (InvalidArgumentException $ e ) {
@@ -141,8 +140,9 @@ private function validateInput(InputInterface $input)
141140 $ this ->staticCheckObjects = [];
142141 $ requiredChecksNames = $ input ->getArgument ('names ' );
143142 // Build list of static check names to run.
144- if (empty ($ requiredChecksNames ) && isset ($ this ->ruleSet ['tests ' ])) {
145- $ requiredChecksNames = $ this ->ruleSet ['tests ' ];
143+ if (empty ($ requiredChecksNames )) {
144+ $ this ->parseRulesetJson ();
145+ $ requiredChecksNames = $ this ->ruleSet ['tests ' ] ?? null ;
146146 }
147147 if (empty ($ requiredChecksNames )) {
148148 $ this ->staticCheckObjects = $ this ->allStaticCheckObjects ;
@@ -192,7 +192,7 @@ private function validateTestNames($requiredChecksNames)
192192 private function parseRulesetJson ()
193193 {
194194 $ pathToRuleset = TESTS_BP . DIRECTORY_SEPARATOR . "staticRuleset.json " ;
195- if ($ pathToRuleset === null ) {
195+ if (! file_exists ( $ pathToRuleset) ) {
196196 $ this ->ioStyle ->text ("No ruleset under $ pathToRuleset " . PHP_EOL );
197197 return ;
198198 }
0 commit comments