Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Task ] Improve and enforce type coverage #35

Merged
merged 2 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Commands/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function handle(): int
$this->info('Installing git hooks...');
}

$this->getHooks()->each(function ($hook) {
$this->getHooks()->each(function (string $hook) {
$this->installHook($hook);
});

Expand Down
2 changes: 1 addition & 1 deletion app/Commands/Scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function handle(): int
return Command::FAILURE;
}

$this->getScripts($this->argument('hook'))->each(function ($script): void {
$this->getScripts($this->argument('hook'))->each(function (string $script): void {
$this->line($script);
});

Expand Down
5 changes: 3 additions & 2 deletions app/Commands/Uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Support\Str;
use LaravelZero\Framework\Commands\Command;
use ProjektGopher\Whisky\Whisky;
use SplFileInfo;

class Uninstall extends Command
{
Expand All @@ -18,8 +19,8 @@ public function handle(): int
collect(
File::files(Whisky::cwd('.git/hooks'))
)->filter(
fn ($file) => ! str_ends_with($file->getFilename(), 'sample')
)->each(function ($file): void {
fn (SplFileInfo $file) => ! str_ends_with($file->getFilename(), 'sample')
)->each(function (SplFileInfo $file): void {
$bin = Whisky::bin();
$path = $file->getPathname();
$hook = $file->getFilename();
Expand Down
7 changes: 4 additions & 3 deletions app/Commands/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Support\Str;
use LaravelZero\Framework\Commands\Command;
use ProjektGopher\Whisky\Whisky;
use SplFileInfo;

/**
* TODO: This command has a lot of duplication.
Expand All @@ -24,7 +25,7 @@ public function handle(): int

$this->uninstall();

$this->getHooks()->each(function ($hook) {
$this->getHooks()->each(function (string $hook) {
$this->installHook($hook);
});

Expand All @@ -38,8 +39,8 @@ private function uninstall(): void
collect(
File::files(Whisky::cwd('.git/hooks'))
)->filter(
fn ($file) => ! str_ends_with($file->getFilename(), 'sample')
)->each(function ($file): void {
fn (SplFileInfo $file) => ! str_ends_with($file->getFilename(), 'sample')
)->each(function (SplFileInfo $file): void {
$path = $file->getPathname();
$hook = $file->getFilename();
$contents = File::get($path);
Expand Down
2 changes: 1 addition & 1 deletion app/Whisky.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function readConfig(string $key): string|array|null
return data_get($cfg, $key);
}

public static function normalizePath($path): string
public static function normalizePath(string $path): string
{
if (Whisky::isWindows()) {
return str_replace('\\', '/', $path);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@php whisky test"
],
"types": [
"vendor/bin/pest --type-coverage --min=88"
"vendor/bin/pest --type-coverage --min=100"
]
},
"minimum-stability": "stable",
Expand Down