diff --git a/src/Console/Commands/Hooks/BaseCodeAnalyzerPreCommitHook.php b/src/Console/Commands/Hooks/BaseCodeAnalyzerPreCommitHook.php index 9044906..481e986 100644 --- a/src/Console/Commands/Hooks/BaseCodeAnalyzerPreCommitHook.php +++ b/src/Console/Commands/Hooks/BaseCodeAnalyzerPreCommitHook.php @@ -74,7 +74,7 @@ public function __construct() */ public function handleCommittedFiles(ChangedFiles $files, Closure $next) { - $commitFiles = $files->getAddedToCommit(); + $commitFiles = $files->getStaged(); if ($commitFiles->isEmpty() || GitHooks::isMergeInProgress()) { return $next($files); diff --git a/tests/Features/Commands/Hooks/BaseCodeAnalyzerPreCommitHookTest.php b/tests/Features/Commands/Hooks/BaseCodeAnalyzerPreCommitHookTest.php index 443f48e..6cc4dfe 100644 --- a/tests/Features/Commands/Hooks/BaseCodeAnalyzerPreCommitHookTest.php +++ b/tests/Features/Commands/Hooks/BaseCodeAnalyzerPreCommitHookTest.php @@ -9,9 +9,9 @@ $this->initializeTempDirectory(base_path('temp')); }); -test('Skips check if there are no files added to commit', function () { +test('Skips check if there are no staged files in commit', function () { $changedFiles = mock(ChangedFiles::class) - ->shouldReceive('getAddedToCommit') + ->shouldReceive('getStaged') ->andReturn(collect()) ->getMock();