Skip to content

Commit fc5d10d

Browse files
committed
pint and duster
1 parent d83116a commit fc5d10d

17 files changed

+111
-31
lines changed

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
],
2727
"require": {
2828
"php": "^8.3 || ^8.2",
29+
"illuminate/contracts": "^10.0||^11.0||^12.0",
2930
"spatie/laravel-package-tools": "^1.16",
30-
"illuminate/contracts": "^10.0||^11.0||^12.0"
31+
"tightenco/duster": "^3.2"
3132
},
3233
"require-dev": {
3334
"driftingly/rector-laravel": "^1.2",
@@ -45,14 +46,12 @@
4546
},
4647
"autoload": {
4748
"psr-4": {
48-
"Msamgan\\LaravelEnvKeysChecker\\": "src/",
49-
"Msamgan\\LaravelEnvKeysChecker\\Database\\Factories\\": "database/factories/"
49+
"Msamgan\\LaravelEnvKeysChecker\\": "src/"
5050
}
5151
},
5252
"autoload-dev": {
5353
"psr-4": {
54-
"Msamgan\\LaravelEnvKeysChecker\\Tests\\": "tests/",
55-
"Workbench\\App\\": "workbench/app/"
54+
"Msamgan\\LaravelEnvKeysChecker\\Tests\\": "tests/"
5655
}
5756
},
5857
"scripts": {
@@ -71,7 +70,7 @@
7170
"analyse": "vendor/bin/phpstan analyse",
7271
"test": "vendor/bin/pest",
7372
"test-coverage": "vendor/bin/pest --coverage",
74-
"format": "./vendor/bin/rector process && vendor/bin/pint"
73+
"format": "./vendor/bin/rector process && vendor/bin/pint && ./vendor/bin/duster fix"
7574
},
7675
"config": {
7776
"sort-packages": true,

config/env-keys-checker.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
return [
46
// List of all the .env files to ignore while checking the env keys
57
'ignore_files' => explode(',', (string) env('KEYS_CHECKER_IGNORE_FILES', '')),

pint.json

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,64 @@
11
{
22
"preset": "laravel",
3+
"notPath": [
4+
"tests/TestCase.php"
5+
],
36
"rules": {
7+
"array_push": true,
8+
"backtick_to_shell_exec": true,
9+
"date_time_immutable": true,
10+
"declare_strict_types": true,
11+
"lowercase_keywords": true,
12+
"lowercase_static_reference": true,
13+
"final_class": true,
14+
"final_internal_class": true,
15+
"final_public_method_for_abstract_class": true,
16+
"fully_qualified_strict_types": true,
17+
"global_namespace_import": {
18+
"import_classes": true,
19+
"import_constants": true,
20+
"import_functions": true
21+
},
22+
"mb_str_functions": true,
23+
"modernize_types_casting": true,
24+
"new_with_parentheses": false,
25+
"no_superfluous_elseif": true,
26+
"no_useless_else": true,
27+
"no_multiple_statements_per_line": true,
28+
"ordered_class_elements": {
29+
"order": [
30+
"use_trait",
31+
"case",
32+
"constant",
33+
"constant_public",
34+
"constant_protected",
35+
"constant_private",
36+
"property_public",
37+
"property_protected",
38+
"property_private",
39+
"construct",
40+
"destruct",
41+
"magic",
42+
"phpunit",
43+
"method_abstract",
44+
"method_public_static",
45+
"method_public",
46+
"method_protected_static",
47+
"method_protected",
48+
"method_private_static",
49+
"method_private"
50+
],
51+
"sort_algorithm": "none"
52+
},
53+
"ordered_interfaces": true,
54+
"ordered_traits": true,
55+
"protected_to_private": true,
56+
"self_accessor": true,
57+
"self_static_accessor": true,
58+
"strict_comparison": true,
59+
"visibility_required": true,
460
"concat_space": {
561
"spacing": "one"
6-
},
7-
"ordered_imports": {
8-
"sort_algorithm": "alpha"
962
}
1063
}
1164
}

src/Actions/AddKeys.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Msamgan\LaravelEnvKeysChecker\Actions;
46

57
use Illuminate\Support\Collection;
68

7-
class AddKeys
9+
final class AddKeys
810
{
911
public function handle(Collection $missingKeys): void
1012
{

src/Actions/CheckKeys.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Msamgan\LaravelEnvKeysChecker\Actions;
46

57
use Illuminate\Support\Collection;
68

7-
class CheckKeys
9+
final class CheckKeys
810
{
911
public function handle(array $keyData, array $envFiles, Collection $missingKeys): void
1012
{

src/Actions/GetKeys.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Msamgan\LaravelEnvKeysChecker\Actions;
46

57
use Illuminate\Support\Collection;
68

7-
class GetKeys
9+
final class GetKeys
810
{
911
public function handle(array|string $files, ?bool $withComments = false): Collection
1012
{
@@ -27,7 +29,7 @@ public function handle(array|string $files, ?bool $withComments = false): Collec
2729
});
2830

2931
if (! $withComments) {
30-
$collection = $collection->filter(fn ($item): bool => $item['key'] !== "\n" && ! str_starts_with((string) $item['key'], '#'));
32+
$collection = $collection->filter(fn ($item): bool => $item['key'] !== "\n" && ! str_starts_with($item['key'], '#'));
3133
}
3234

3335
return $collection->reject(fn ($keyData): bool => in_array($keyData['key'], $ignoredKeys));

src/Commands/EnvInGitIgnoreCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Msamgan\LaravelEnvKeysChecker\Commands;
46

57
use Illuminate\Console\Command;
68
use Msamgan\LaravelEnvKeysChecker\Concerns\HelperFunctions;
79

8-
class EnvInGitIgnoreCommand extends Command
10+
final class EnvInGitIgnoreCommand extends Command
911
{
1012
use HelperFunctions;
1113

src/Commands/EnvKeysSyncCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Msamgan\LaravelEnvKeysChecker\Commands;
46

57
use Illuminate\Console\Command;
68
use Msamgan\LaravelEnvKeysChecker\Concerns\HelperFunctions;
79

8-
class EnvKeysSyncCommand extends Command
10+
final class EnvKeysSyncCommand extends Command
911
{
1012
use HelperFunctions;
1113

@@ -118,7 +120,7 @@ private function checkIfEmptyLine(string $line): bool
118120
private function moveKeyToLine(string $file, string $key, int $toLine): void
119121
{
120122
$lines = file(filename: $file);
121-
$keyLine = array_filter(array: $lines, callback: fn ($line): bool => str_starts_with((string) $line, $key));
123+
$keyLine = array_filter(array: $lines, callback: fn ($line): bool => str_starts_with($line, $key));
122124

123125
if ($keyLine === []) {
124126
return;

src/Commands/KeysCheckerCommand.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Msamgan\LaravelEnvKeysChecker\Commands;
46

57
use Illuminate\Console\Command;
68
use Illuminate\Support\Collection;
7-
8-
use function Laravel\Prompts\confirm;
9-
use function Laravel\Prompts\progress;
10-
use function Laravel\Prompts\table;
11-
129
use Msamgan\LaravelEnvKeysChecker\Actions\AddKeys;
1310
use Msamgan\LaravelEnvKeysChecker\Actions\CheckKeys;
1411
use Msamgan\LaravelEnvKeysChecker\Actions\GetKeys;
1512
use Msamgan\LaravelEnvKeysChecker\Concerns\HelperFunctions;
1613

17-
class KeysCheckerCommand extends Command
14+
use function Laravel\Prompts\confirm;
15+
use function Laravel\Prompts\progress;
16+
use function Laravel\Prompts\table;
17+
18+
final class KeysCheckerCommand extends Command
1819
{
1920
use HelperFunctions;
2021

src/Concerns/HelperFunctions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Msamgan\LaravelEnvKeysChecker\Concerns;
46

57
use function Laravel\Prompts\error;

0 commit comments

Comments
 (0)