Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vlucas/phpdotenv
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.1.2
Choose a base ref
...
head repository: vlucas/phpdotenv
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.1.3
Choose a head ref

Commits on Jan 28, 2019

  1. Updated branch alias

    GrahamCampbell committed Jan 28, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d7f715a View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    aa4be46 View commit details
  3. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    cea7e2e View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2a0c63f View commit details
  5. Fixed PHP 5.3 support

    GrahamCampbell committed Jan 28, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5f0fbb8 View commit details
  6. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    e53b2c3 View commit details
  7. Test both variants

    GrahamCampbell committed Jan 28, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e918eac View commit details
  8. Merge pull request #325 from vlucas/parser-backport

    [2.6] Backport parser fixes from 3.3.0
    GrahamCampbell authored Jan 28, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f3aae28 View commit details

Commits on Jan 29, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2a7dcf7 View commit details

Commits on Mar 27, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    31621bf View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0de6841 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    eea090d View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e9a7fac View commit details
  5. Merge branch '3.6'

    GrahamCampbell committed Mar 27, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    12831c5 View commit details
  6. Updated tests for 4.x

    GrahamCampbell committed Mar 27, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8efcd4c View commit details
  7. Copy the full SHA
    4f3a400 View commit details
  8. Copy the full SHA
    8bdc950 View commit details
  9. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    db354ca View commit details
  10. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c4a653e View commit details
  11. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    884ab15 View commit details
  12. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    786a947 View commit details
  13. Merge branch '3.6'

    GrahamCampbell committed Mar 27, 2020
    1

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    88f7acc View commit details
Showing with 15 additions and 1 deletion.
  1. +3 −1 composer.json
  2. +4 −0 src/Validator.php
  3. +8 −0 tests/Dotenv/ValidatorTest.php
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
},
"require-dev": {
"ext-filter": "*",
"ext-pcre": "*",
"bamarni/composer-bin-plugin": "^1.3",
"phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0"
},
@@ -36,7 +37,8 @@
}
},
"suggest": {
"ext-filter": "Required to use the boolean validator."
"ext-filter": "Required to use the boolean validator.",
"ext-pcre": "Required to use most of the library."
},
"extra": {
"branch-alias": {
4 changes: 4 additions & 0 deletions src/Validator.php
Original file line number Diff line number Diff line change
@@ -128,6 +128,10 @@ public function allowedValues(array $choices)
{
return $this->assertCallback(
function ($value) use ($choices) {
if ($value === null) {
return true;
}

return in_array($value, $choices, true);
},
sprintf('is not one of [%s]', implode(', ', $choices))
8 changes: 8 additions & 0 deletions tests/Dotenv/ValidatorTest.php
Original file line number Diff line number Diff line change
@@ -41,6 +41,14 @@ public function testDotenvAllowedValuesIfPresent()
$this->assertTrue(true);
}

public function testDotenvAllowedValuesIfNotPresent()
{
$dotenv = Dotenv::createImmutable($this->fixturesFolder);
$dotenv->load();
$dotenv->ifPresent('FOOQWERTYOOOOOO')->allowedValues(['bar', 'baz']);
$this->assertTrue(true);
}

/**
* @expectedException \Dotenv\Exception\ValidationException
* @expectedExceptionMessage One or more environment variables failed assertions: FOO is not one of [buzz, buz].