Skip to content

Commit

Permalink
Merge pull request #74 from fitztrev/patch-1
Browse files Browse the repository at this point in the history
Upgrade dotenv to v3
  • Loading branch information
mpociot authored Feb 27, 2019
2 parents cc347c1 + 9e0bd34 commit 57d8707
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sudo: required
php:
- 7.1
- 7.2
- 7.3

env:
matrix:
Expand Down
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
"composer/semver": "^1.4",
"geerlingguy/ping": "^1.1",
"illuminate/support": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*",
"vlucas/phpdotenv": "~2.5"
"vlucas/phpdotenv": "~2.5|~3.3"
},
"require-dev": {
"larapack/dd": "^1.0",
"mockery/mockery": "^1.0",
"orchestra/testbench": "~3.5",
"orchestra/testbench": "~3.5|~3.8",
"phpunit/phpunit": "^7.0",
"predis/predis": "^1.1",
"scrutinizer/ocular": "^1.5"
Expand All @@ -43,7 +43,6 @@
"scripts": {
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"

},
"config": {
"sort-packages": true
Expand Down
11 changes: 8 additions & 3 deletions src/Checks/ExampleEnvironmentVariablesAreSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ public function name(array $config): string
*/
public function check(array $config): bool
{
$examples = new Dotenv(base_path(), '.env.example');
$examples->safeLoad();
if (interface_exists(\Dotenv\Environment\FactoryInterface::class)) {
$examples = Dotenv::create(base_path(), '.env.example');
$actual = Dotenv::create(base_path(), '.env');
} else {
$examples = new Dotenv(base_path(), '.env.example');
$actual = new Dotenv(base_path(), '.env');
}

$actual = new Dotenv(base_path(), '.env');
$examples->safeLoad();
$actual->safeLoad();

$this->envVariables = Collection::make($examples->getEnvironmentVariableNames())
Expand Down
11 changes: 8 additions & 3 deletions src/Checks/ExampleEnvironmentVariablesAreUpToDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ public function name(array $config): string
*/
public function check(array $config): bool
{
$examples = new Dotenv(base_path(), '.env.example');
$examples->safeLoad();
if (interface_exists(\Dotenv\Environment\FactoryInterface::class)) {
$examples = Dotenv::create(base_path(), '.env.example');
$actual = Dotenv::create(base_path(), '.env');
} else {
$examples = new Dotenv(base_path(), '.env.example');
$actual = new Dotenv(base_path(), '.env');
}

$actual = new Dotenv(base_path(), '.env');
$examples->safeLoad();
$actual->safeLoad();

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

0 comments on commit 57d8707

Please sign in to comment.