Skip to content

Commit

Permalink
fix: pint
Browse files Browse the repository at this point in the history
  • Loading branch information
utsavsomaiya committed Oct 30, 2024
1 parent 3797e51 commit eb8f1fd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion app/Contracts/PathsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ interface PathsRepository
*/
public function dirty();


/**
* Determine the "staged" files.
*
Expand Down
2 changes: 1 addition & 1 deletion app/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static function paths($input)
}

if ($input->getOption('staged')) {
return static::resolveStagedPaths();
return static::resolveStagedPaths();
}

return $input->getArgument('path');
Expand Down
10 changes: 5 additions & 5 deletions app/Repositories/GitPathsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@ public function staged()
{
$process = tap(new Process(['git', 'diff', '--cached', '--name-only', '--diff-filter=ACM', '--', '**.php']))->run();

if (! $process->isSuccessful()) {
if (! $process->isSuccessful()) {
abort(1, 'The [--staged] option is only available when using Git.');
}
}

$stagedFiles = collect(preg_split('/\R+/', $process->getOutput(), flags: PREG_SPLIT_NO_EMPTY))
$stagedFiles = collect(preg_split('/\R+/', $process->getOutput(), flags: PREG_SPLIT_NO_EMPTY))
->map(function ($file) {
if (PHP_OS_FAMILY === 'Windows') {
$file = str_replace('/', DIRECTORY_SEPARATOR, $file);
}

return $this->path . DIRECTORY_SEPARATOR . $file;
return $this->path.DIRECTORY_SEPARATOR.$file;
})
->values()
->all();

$files = array_values(array_map(function ($splFile) {
$files = array_values(array_map(function ($splFile) {
return $splFile->getPathname();
}, iterator_to_array(ConfigurationFactory::finder()
->in($this->path)
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/StagedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
->shouldReceive('staged')
->once()
->andReturn([
base_path('tests/Fixtures/without-issues-laravel/file.php'),
base_path('tests/Fixtures/without-issues-laravel/file.php'),
]);

$this->swap(PathsRepository::class, $paths);
Expand Down

0 comments on commit eb8f1fd

Please sign in to comment.