diff --git a/app/Actions/ElaborateSummary.php b/app/Actions/ElaborateSummary.php index ee18a76c..f4613a9f 100644 --- a/app/Actions/ElaborateSummary.php +++ b/app/Actions/ElaborateSummary.php @@ -40,7 +40,7 @@ public function execute($totalFiles, $changes) $totalFiles, 0, 0, - OutputInterface::VERBOSITY_VERBOSE <= $this->output->getVerbosity(), + $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE, $this->input->getOption('test'), $this->output->isDecorated() ); diff --git a/resources/presets/laravel.php b/resources/presets/laravel.php index 9af2d071..dfb53f2b 100644 --- a/resources/presets/laravel.php +++ b/resources/presets/laravel.php @@ -202,7 +202,7 @@ ], 'whitespace_after_comma_in_array' => true, 'yoda_style' => [ - 'always_move_variable' => true, + 'always_move_variable' => false, 'equal' => false, 'identical' => false, 'less_and_greater' => false, diff --git a/tests/Feature/Fixers/YodaStyleFixerTest.php b/tests/Feature/Fixers/YodaStyleFixerTest.php new file mode 100644 index 00000000..a9e7b097 --- /dev/null +++ b/tests/Feature/Fixers/YodaStyleFixerTest.php @@ -0,0 +1,21 @@ + base_path('tests/Fixtures/fixers/yoda_style.php'), + '--preset' => 'laravel', + ]); + + expect($statusCode)->toBe(1) + ->and($output) + ->toContain(' тип') + ->toContain('@@ -20,6 +20,6 @@') + ->toContain( + <<<'EOF' + -if (null === $int) { + +if ($int === null) { + // + } + EOF, + ); +}); diff --git a/tests/Fixtures/fixers/yoda_style.php b/tests/Fixtures/fixers/yoda_style.php new file mode 100644 index 00000000..0289edb5 --- /dev/null +++ b/tests/Fixtures/fixers/yoda_style.php @@ -0,0 +1,25 @@ +count() === $int) { + // +} + +if (array_values($array) !== $array) { + // +} + +if ($object->int === $int && (int) $object->int === $int) { + // +} + +if (null === $int) { + // +}