File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ public function name(array $config): string
29
29
*/
30
30
public function check (array $ config ): bool
31
31
{
32
+ if (method_exists (Dotenv::class, 'createUnsafeImmutable ' )) {
33
+ return $ this ->checkForDotEnvV5 ();
34
+ }
32
35
if (method_exists (Dotenv::class, 'createImmutable ' )) {
33
36
return $ this ->checkForDotEnvV4 ();
34
37
}
@@ -67,6 +70,23 @@ private function checkForDotEnvV4(): bool
67
70
return $ this ->envVariables ->isEmpty ();
68
71
}
69
72
73
+ /**
74
+ * Perform the verification of this check for DotEnv v5.
75
+ *
76
+ * @return bool
77
+ */
78
+ private function checkForDotEnvV5 (): bool
79
+ {
80
+ $ examples = Dotenv::createMutable (base_path (), '.env.example ' );
81
+ $ actual = Dotenv::createMutable (base_path (), '.env ' );
82
+
83
+ $ this ->envVariables = Collection::make ($ examples ->safeLoad ())
84
+ ->diffKeys ($ actual ->safeLoad ())
85
+ ->keys ();
86
+
87
+ return $ this ->envVariables ->isEmpty ();
88
+ }
89
+
70
90
/**
71
91
* The error message to display in case the check does not pass.
72
92
*
You can’t perform that action at this time.
0 commit comments