Skip to content

Commit f9255d2

Browse files
author
cradu
committed
pint fixes
1 parent fa953bb commit f9255d2

17 files changed

+30
-44
lines changed

src/Console/Commands/Hooks/BaseCodeAnalyzerPreCommitHook.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ abstract class BaseCodeAnalyzerPreCommitHook implements CodeAnalyzerPreCommitHoo
6868
protected string $dockerContainer = '';
6969

7070
/**
71-
* @var Chunk size used for analyze
71+
* Chunk size used for analyze
7272
*/
7373
protected int $chunkSize = 100;
7474

@@ -306,7 +306,7 @@ protected function validateAnalyzerInstallation(): self
306306
);
307307
$this->command->newLine();
308308

309-
throw new HookFailException();
309+
throw new HookFailException;
310310
}
311311

312312
/**
@@ -329,7 +329,7 @@ protected function validateConfigPath(string $path): self
329329
);
330330
$this->command->newLine();
331331

332-
throw new HookFailException();
332+
throw new HookFailException;
333333
}
334334

335335
/**
@@ -363,7 +363,7 @@ protected function suggestAutoFixOrExit(): bool
363363
$this->markPipelineFailed();
364364

365365
if (config('git-hooks.stop_at_first_analyzer_failure')) {
366-
throw new HookFailException();
366+
throw new HookFailException;
367367
}
368368

369369
return false;

src/Console/Commands/PreCommit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function handle(): int
5252

5353
if ($this->checkPipelineFailed()) {
5454
$this->clearPipelineFailed();
55-
throw new HookFailException();
55+
throw new HookFailException;
5656
}
5757
} catch (HookFailException) {
5858
return 1;

src/Exceptions/HookFailException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@
66

77
use RuntimeException;
88

9-
class HookFailException extends RuntimeException
10-
{
11-
}
9+
class HookFailException extends RuntimeException {}

src/GitHooksServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ public function register(): void
3939
// Automatically apply the package configuration
4040
$this->mergeConfigFrom(__DIR__.'/../config/git-hooks.php', 'laravel-git-hooks');
4141

42-
$this->app->singleton('laravel-git-hooks', fn () => new GitHooks());
42+
$this->app->singleton('laravel-git-hooks', fn () => new GitHooks);
4343
}
4444
}

src/Traits/WithPipelineFailCheck.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ protected function markPipelineFailed(): void
1212
{
1313
$tmpFile = $this->getPipelineFailedTempFile();
1414
if (touch($tmpFile) === false) {
15-
throw new HookFailException();
15+
throw new HookFailException;
1616
}
1717
}
1818

tests/Features/Commands/Hooks/BaseCodeAnalyzerPreCommitHookTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
$next = fn ($files) => 'passed';
1919

20-
$hook = new ConcreteBaseCodeAnalyzerFixture();
20+
$hook = new ConcreteBaseCodeAnalyzerFixture;
2121
$result = $hook->handleCommittedFiles($changedFiles, $next);
2222
expect($result)->toBe('passed');
2323
});
@@ -28,7 +28,7 @@
2828

2929
$next = fn ($files) => 'passed';
3030

31-
$hook = new ConcreteBaseCodeAnalyzerFixture();
31+
$hook = new ConcreteBaseCodeAnalyzerFixture;
3232
$result = $hook->handleCommittedFiles($changedFiles, $next);
3333
expect($result)->toBe('passed');
3434
})->with('modifiedFilesList');
@@ -44,7 +44,7 @@ function ($configName, $nonExistentPathConfig, $preCommitHookClass, $listOfFixab
4444
GitHooks::shouldReceive('isMergeInProgress')->andReturn(false);
4545
GitHooks::shouldReceive('getListOfChangedFiles')->andReturn($listOfFixablePhpFiles);
4646

47-
$preCommitHook = new $preCommitHookClass();
47+
$preCommitHook = new $preCommitHookClass;
4848
$this->artisan('git-hooks:pre-commit')
4949
->expectsOutputToContain($preCommitHook->getName().' is not installed.')
5050
->assertExitCode(1);
@@ -62,7 +62,7 @@ function ($configName, $nonExistentPathConfig, $preCommitHookClass, $listOfFixab
6262
GitHooks::shouldReceive('isMergeInProgress')->andReturn(false);
6363
GitHooks::shouldReceive('getListOfChangedFiles')->andReturn($listOfFixablePhpFiles);
6464

65-
$preCommitHook = new $preCommitHookClass();
65+
$preCommitHook = new $preCommitHookClass;
6666
$this->artisan('git-hooks:pre-commit')
6767
->expectsOutputToContain($preCommitHook->getName().' config file does not exist.')
6868
->assertExitCode(1);

tests/Features/Commands/Hooks/EnlightnPreCommitHookTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
$next = fn ($files) => 'passed';
2424

25-
$hook = new EnlightnPreCommitHook();
25+
$hook = new EnlightnPreCommitHook;
2626
$result = $hook->handle($changedFiles, $next);
2727
expect($result)->toBe('passed');
2828
});
@@ -44,7 +44,7 @@
4444
$command = $commands['git-hooks:pre-commit'];
4545

4646
$input = new ArrayInput([]);
47-
$output = new BufferedOutput();
47+
$output = new BufferedOutput;
4848

4949
$exitCode = $command->run($input, $output);
5050
$outputText = $output->fetch();

tests/Features/Commands/PostCommitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
$postCommitHook1 = Mockery::mock(PostCommitHook::class);
4141
$postCommitHook1->expects('handle')
4242
->andReturnUsing(function (Log $log, Closure $closure): never {
43-
throw new HookFailException();
43+
throw new HookFailException;
4444
});
4545

4646
$this->config->set('git-hooks.post-commit', [

tests/Features/Commands/PreCommitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
$preCommitHook1 = Mockery::mock(PreCommitHook::class);
4545
$preCommitHook1->expects('handle')
4646
->andReturnUsing(function (ChangedFiles $files, Closure $closure): never {
47-
throw new HookFailException();
47+
throw new HookFailException;
4848
});
4949

5050
$this->config->set('git-hooks.pre-commit', [

tests/Features/Commands/PrepareCommitMessageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
$postCommitHook1 = Mockery::mock(MessageHook::class);
4646
$postCommitHook1->expects('handle')
4747
->andReturnUsing(function (CommitMessage $commitMessage, Closure $closure): never {
48-
throw new HookFailException();
48+
throw new HookFailException;
4949
});
5050

5151
$this->config->set('git-hooks.prepare-commit-msg', [

0 commit comments

Comments
 (0)