Skip to content

Commit 42ce4ca

Browse files
committed
Check if .env exists
1 parent dd5236e commit 42ce4ca

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"orchestra/testbench": "^9.2",
3939
"phpunit/phpunit": "^10.5",
4040
"spatie/phpunit-snapshot-assertions": "^4 || ^5",
41-
"vimeo/psalm": "^5.4"
41+
"vimeo/psalm": "^5.4",
42+
"vlucas/phpdotenv": "^5"
4243
},
4344
"suggest": {
4445
"illuminate/events": "Required for automatic helper generation (^6|^7|^8|^9|^10|^11)."

src/Console/MetaCommand.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,13 @@ protected function getOptions()
338338

339339
protected function getEnv()
340340
{
341+
$envPath = base_path('.env');
342+
if (!file_exists($envPath)) {
343+
return [];
344+
}
345+
341346
$parser = new Parser();
342-
$entries = $parser->parse(file_get_contents(base_path('.env')));
347+
$entries = $parser->parse(file_get_contents($envPath));
343348

344349
return collect($entries)->map(function (Entry $entry) {
345350
return $entry->getName();

0 commit comments

Comments
 (0)