Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added process of booleans #1

Merged
merged 3 commits into from
Feb 17, 2021
Merged

Added process of booleans #1

merged 3 commits into from
Feb 17, 2021

Conversation

jaumarar
Copy link
Contributor

@jaumarar jaumarar commented Feb 7, 2021

If the .env file has a boolean value it will be parsed into the correct type:

.env file:
VARIABLE=true

Before:
$_ENV['VARIABLE] = 'true';

Now:
$_ENV['VARIABLE] = true;

  • Also added test and make this option configurable via DotEnv::PROCESS_BOOLEANS.
  • Attribute @runInSeparateProcess has been added to the test to restart $_ENV variables

Copy link
Owner

@devcoder-xyz devcoder-xyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve the changes but I have a few remarks:

  • In processValue declare argument type as string
  • In load function , is not necessary return the values that have been loaded into ENV

Thanks

@jaumarar
Copy link
Contributor Author

Perfect, I think all changes have been made

@devcoder-xyz
Copy link
Owner

Ok for me , thanks

@devcoder-xyz devcoder-xyz merged commit 7d1e192 into devcoder-xyz:main Feb 17, 2021
@devcoder-xyz
Copy link
Owner

You are forget to remove unit test about returns values :

/**
* @runInSeparateProcess
*/
public function testLoadReturnsValues()
{
$loaded = (new DotEnv($this->env('.env.return')))->load();

    $this->assertEquals('returned', $loaded['VALUE']);
    $this->assertEquals('returned', $_ENV['VALUE']);
}

test failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants