diff --git a/app/Actions/ElaborateSummary.php b/app/Actions/ElaborateSummary.php index 7e91f2f7..8c30103a 100644 --- a/app/Actions/ElaborateSummary.php +++ b/app/Actions/ElaborateSummary.php @@ -69,12 +69,12 @@ public function execute($totalFiles, $changes) protected function displayUsingFormatter($summary, $totalFiles) { $reporter = match ($format = $this->input->getOption('format')) { - 'checkstyle' => new FixReport\CheckstyleReporter(), - 'gitlab' => new FixReport\GitlabReporter(), - 'json' => new FixReport\JsonReporter(), - 'junit' => new FixReport\JunitReporter(), - 'txt' => new FixReport\TextReporter(), - 'xml' => new FixReport\XmlReporter(), + 'checkstyle' => new FixReport\CheckstyleReporter, + 'gitlab' => new FixReport\GitlabReporter, + 'json' => new FixReport\JsonReporter, + 'junit' => new FixReport\JunitReporter, + 'txt' => new FixReport\TextReporter, + 'xml' => new FixReport\XmlReporter, default => abort(1, sprintf('Format [%s] is not supported.', $format)), }; diff --git a/app/Factories/ConfigurationFactory.php b/app/Factories/ConfigurationFactory.php index 1826822d..b42ab909 100644 --- a/app/Factories/ConfigurationFactory.php +++ b/app/Factories/ConfigurationFactory.php @@ -42,7 +42,7 @@ class ConfigurationFactory */ public static function preset($rules) { - return (new Config()) + return (new Config) ->setParallelConfig(ParallelConfigFactory::detect()) ->setFinder(self::finder()) ->setRules(array_merge($rules, resolve(ConfigurationJsonRepository::class)->rules())) diff --git a/app/Factories/ConfigurationResolverFactory.php b/app/Factories/ConfigurationResolverFactory.php index 37b140bb..33b25823 100644 --- a/app/Factories/ConfigurationResolverFactory.php +++ b/app/Factories/ConfigurationResolverFactory.php @@ -70,7 +70,7 @@ public static function fromIO($input, $output) 'show-progress' => 'true', ], Project::path(), - new ToolInfo(), + new ToolInfo, ); $totalFiles = count(new ArrayIterator(iterator_to_array( diff --git a/app/Output/ProgressOutput.php b/app/Output/ProgressOutput.php index 2f07a442..588f7e14 100644 --- a/app/Output/ProgressOutput.php +++ b/app/Output/ProgressOutput.php @@ -37,7 +37,7 @@ public function __construct( protected $input, protected $output, ) { - $this->symbolsPerLine = (new Terminal())->getWidth() - 4; + $this->symbolsPerLine = (new Terminal)->getWidth() - 4; } /** @@ -70,7 +70,7 @@ public function handle($event) { $symbolsOnCurrentLine = $this->processed % $this->symbolsPerLine; - if ($symbolsOnCurrentLine >= (new Terminal())->getWidth() - 4) { + if ($symbolsOnCurrentLine >= (new Terminal)->getWidth() - 4) { $symbolsOnCurrentLine = 0; } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 4aec48cc..3143218f 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -26,11 +26,11 @@ public function boot() public function register() { $this->app->singleton(ErrorsManager::class, function () { - return new ErrorsManager(); + return new ErrorsManager; }); $this->app->singleton(EventDispatcher::class, function () { - return new EventDispatcher(); + return new EventDispatcher; }); } } diff --git a/app/ValueObjects/Issue.php b/app/ValueObjects/Issue.php index 94c16edc..0263afb8 100644 --- a/app/ValueObjects/Issue.php +++ b/app/ValueObjects/Issue.php @@ -74,7 +74,7 @@ public function code() $exception = $this->payload['source']->getPrevious() ?: $this->payload['source']; - return (new Highlighter())->highlight($content, $exception->getLine()); + return (new Highlighter)->highlight($content, $exception->getLine()); } return $this->diff(); @@ -98,7 +98,7 @@ public function symbol() protected function diff() { if ($this->payload['diff']) { - $highlighter = new Highlighter(); + $highlighter = new Highlighter; $reflector = new ReflectionClass($highlighter); $diff = $this->payload['diff']; diff --git a/resources/presets/laravel.php b/resources/presets/laravel.php index f8b436ba..98666f48 100644 --- a/resources/presets/laravel.php +++ b/resources/presets/laravel.php @@ -82,6 +82,10 @@ ], 'native_function_casing' => true, 'native_type_declaration_casing' => true, + 'new_with_parentheses' => [ + 'named_class' => false, + 'anonymous_class' => false, + ], 'no_alias_functions' => true, 'no_alias_language_construct_call' => true, 'no_alternative_syntax' => true, diff --git a/tests/Feature/DirtyTest.php b/tests/Feature/DirtyTest.php index 5bb87c3c..c72bcac3 100644 --- a/tests/Feature/DirtyTest.php +++ b/tests/Feature/DirtyTest.php @@ -9,7 +9,7 @@ ->shouldReceive('dirty') ->once() ->andReturn([ - base_path('tests/Fixtures/without-issues/file.php'), + base_path('tests/Fixtures/without-issues-laravel/file.php'), ]); $this->swap(PathsRepository::class, $paths); @@ -28,7 +28,7 @@ ->shouldReceive('dirty') ->once() ->andReturn([ - base_path('tests/Fixtures/without-issues/file.php'), + base_path('tests/Fixtures/without-issues-laravel/file.php'), ]); $this->swap(PathsRepository::class, $paths); diff --git a/tests/Feature/PresetTest.php b/tests/Feature/PresetTest.php index 1d1c5a66..0c99db6e 100644 --- a/tests/Feature/PresetTest.php +++ b/tests/Feature/PresetTest.php @@ -2,7 +2,7 @@ it('uses the laravel preset by default', function () { [$statusCode, $output] = run('default', [ - 'path' => base_path('tests/Fixtures/without-issues'), + 'path' => base_path('tests/Fixtures/without-issues-laravel'), ]); expect($statusCode)->toBe(0) @@ -34,7 +34,7 @@ it('may use the Laravel preset', function () { [$statusCode, $output] = run('default', [ - 'path' => base_path('tests/Fixtures/without-issues'), + 'path' => base_path('tests/Fixtures/without-issues-laravel'), '--preset' => 'laravel', ]); diff --git a/tests/Feature/RepairTest.php b/tests/Feature/RepairTest.php index 2316e659..7d6d65a7 100644 --- a/tests/Feature/RepairTest.php +++ b/tests/Feature/RepairTest.php @@ -23,7 +23,7 @@ it('exits with status 0 without fixes', function () { [$statusCode, $output] = run('default', [ - 'path' => base_path('tests/Fixtures/without-issues'), + 'path' => base_path('tests/Fixtures/without-issues-laravel'), '--repair' => true, '--test' => false, ]); diff --git a/tests/Feature/SummaryTest.php b/tests/Feature/SummaryTest.php index de61aa0b..65334ddd 100755 --- a/tests/Feature/SummaryTest.php +++ b/tests/Feature/SummaryTest.php @@ -31,7 +31,7 @@ it('may pass', function () { [$statusCode, $output] = run('default', [ - 'path' => base_path('tests/Fixtures/without-issues'), + 'path' => base_path('tests/Fixtures/without-issues-laravel'), ]); expect($statusCode)->toBe(0) diff --git a/tests/Fixtures/without-issues-laravel/file.php b/tests/Fixtures/without-issues-laravel/file.php new file mode 100644 index 00000000..6cfa6a99 --- /dev/null +++ b/tests/Fixtures/without-issues-laravel/file.php @@ -0,0 +1,3 @@ +