File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 30
30
"require-dev" : {
31
31
"laravel/pint" : " ^1.14" ,
32
32
"nunomaduro/collision" : " ^8.1.1||^7.10.0" ,
33
- "larastan/larastan" : " ^2.9 " ,
33
+ "larastan/larastan" : " ^3.0 " ,
34
34
"orchestra/testbench" : " ^9.0.0||^8.22.0" ,
35
35
"pestphp/pest" : " ^2.34" ,
36
36
"pestphp/pest-plugin-arch" : " ^2.7" ,
37
37
"pestphp/pest-plugin-laravel" : " ^2.3" ,
38
- "phpstan/extension-installer" : " ^1.3 " ,
39
- "phpstan/phpstan-deprecation-rules" : " ^1.1 " ,
40
- "phpstan/phpstan-phpunit" : " ^1.3 "
38
+ "phpstan/extension-installer" : " ^1.4 " ,
39
+ "phpstan/phpstan-deprecation-rules" : " ^2.0 " ,
40
+ "phpstan/phpstan-phpunit" : " ^2.0 "
41
41
},
42
42
"autoload" : {
43
43
"psr-4" : {
Original file line number Diff line number Diff line change @@ -10,3 +10,4 @@ parameters:
10
10
tmpDir: build/phpstan
11
11
checkOctaneCompatibility: true
12
12
checkModelProperties: true
13
+ noEnvCallsOutsideOfConfig: false
Original file line number Diff line number Diff line change 13
13
*/
14
14
class DeadCommand extends TranslatorCommand implements PromptsForMissingInput
15
15
{
16
- public $ signature = 'translator:dead {locale} {--driver=} ' ;
16
+ public $ signature = 'translator:dead {locale} {--sync : Delete the dead keys from your driver} {-- driver=} ' ;
17
17
18
18
public $ description = 'Display all the translation keys not found in the codebase. ' ;
19
19
20
20
public function handle (): int
21
21
{
22
22
$ locale = $ this ->argument ('locale ' );
23
+ $ sync = (bool ) $ this ->option ('sync ' );
23
24
24
25
$ translator = $ this ->getTranslator ();
25
26
@@ -43,6 +44,17 @@ public function handle(): int
43
44
->all ()
44
45
);
45
46
47
+ if ($ sync ) {
48
+
49
+ $ translator ->deleteTranslations (
50
+ locale: $ locale ,
51
+ keys: $ dead ->keys ()->toArray ()
52
+ );
53
+
54
+ note (count ($ dead ).' dead translations deleted from the driver. ' );
55
+
56
+ }
57
+
46
58
return self ::SUCCESS ;
47
59
}
48
60
}
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ public function getTranslations(string $locale): PhpTranslations
63
63
})
64
64
->dot ()
65
65
->map (function ($ value ) {
66
- if (is_array ( $ value ) && empty ($ value )) {
66
+ if (empty ($ value )) {
67
67
return null ;
68
68
}
69
69
You can’t perform that action at this time.
0 commit comments