Skip to content

Commit 57d8707

Browse files
authored
Merge pull request #74 from fitztrev/patch-1
Upgrade dotenv to v3
2 parents cc347c1 + 9e0bd34 commit 57d8707

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ sudo: required
44
php:
55
- 7.1
66
- 7.2
7+
- 7.3
78

89
env:
910
matrix:

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
"composer/semver": "^1.4",
2121
"geerlingguy/ping": "^1.1",
2222
"illuminate/support": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*",
23-
"vlucas/phpdotenv": "~2.5"
23+
"vlucas/phpdotenv": "~2.5|~3.3"
2424
},
2525
"require-dev": {
2626
"larapack/dd": "^1.0",
2727
"mockery/mockery": "^1.0",
28-
"orchestra/testbench": "~3.5",
28+
"orchestra/testbench": "~3.5|~3.8",
2929
"phpunit/phpunit": "^7.0",
3030
"predis/predis": "^1.1",
3131
"scrutinizer/ocular": "^1.5"
@@ -43,7 +43,6 @@
4343
"scripts": {
4444
"test": "vendor/bin/phpunit",
4545
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
46-
4746
},
4847
"config": {
4948
"sort-packages": true

src/Checks/ExampleEnvironmentVariablesAreSet.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ public function name(array $config): string
2929
*/
3030
public function check(array $config): bool
3131
{
32-
$examples = new Dotenv(base_path(), '.env.example');
33-
$examples->safeLoad();
32+
if (interface_exists(\Dotenv\Environment\FactoryInterface::class)) {
33+
$examples = Dotenv::create(base_path(), '.env.example');
34+
$actual = Dotenv::create(base_path(), '.env');
35+
} else {
36+
$examples = new Dotenv(base_path(), '.env.example');
37+
$actual = new Dotenv(base_path(), '.env');
38+
}
3439

35-
$actual = new Dotenv(base_path(), '.env');
40+
$examples->safeLoad();
3641
$actual->safeLoad();
3742

3843
$this->envVariables = Collection::make($examples->getEnvironmentVariableNames())

src/Checks/ExampleEnvironmentVariablesAreUpToDate.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ public function name(array $config): string
2929
*/
3030
public function check(array $config): bool
3131
{
32-
$examples = new Dotenv(base_path(), '.env.example');
33-
$examples->safeLoad();
32+
if (interface_exists(\Dotenv\Environment\FactoryInterface::class)) {
33+
$examples = Dotenv::create(base_path(), '.env.example');
34+
$actual = Dotenv::create(base_path(), '.env');
35+
} else {
36+
$examples = new Dotenv(base_path(), '.env.example');
37+
$actual = new Dotenv(base_path(), '.env');
38+
}
3439

35-
$actual = new Dotenv(base_path(), '.env');
40+
$examples->safeLoad();
3641
$actual->safeLoad();
3742

3843
$this->envVariables = Collection::make($actual->getEnvironmentVariableNames())

0 commit comments

Comments
 (0)