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: v5.4.1
Choose a base ref
...
head repository: vlucas/phpdotenv
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.5.0
Choose a head ref
  • 15 commits
  • 36 files changed
  • 6 contributors

Commits on Dec 14, 2021

  1. Set allow-plugins for Composer 2.2 (#505)

    This new configuration has been introduced with Composer 2.2: https://github.com/composer/composer/releases/tag/2.2.0-RC1
    villfa authored Dec 14, 2021

    Verified

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

    GrahamCampbell committed Dec 14, 2021

    Verified

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

Commits on Dec 17, 2021

  1. Reduce confusion (#506)

    discern authored Dec 17, 2021

    Verified

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

Commits on Oct 15, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9f52bcb View commit details
  2. 2
    Copy the full SHA
    3b56df1 View commit details
  3. Merge branch '4.3'

    GrahamCampbell committed Oct 15, 2022
    Copy the full SHA
    4c16545 View commit details
  4. [5.5] Typofixes (#539)

    nexxai authored Oct 15, 2022
    Copy the full SHA
    c7e5327 View commit details
  5. Bumped branch alias

    GrahamCampbell committed Oct 15, 2022
    Copy the full SHA
    888448c View commit details
  6. Copy the full SHA
    c349cad View commit details
  7. Merge branch '4.3'

    GrahamCampbell committed Oct 15, 2022
    6
    Copy the full SHA
    b674e23 View commit details
  8. Verified

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

    GrahamCampbell committed Oct 15, 2022

    Verified

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

Commits on Oct 16, 2022

  1. Copy the full SHA
    67a491d View commit details
  2. Merge branch '4.3'

    GrahamCampbell committed Oct 16, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f926695 View commit details
  3. [5.5] Add support for unicode variable names (#546)

    Co-authored-by: Thor Erik <219796+thorerik@users.noreply.github.com>
    GrahamCampbell and aidabeorn authored Oct 16, 2022
    Copy the full SHA
    1a7ea2a View commit details
Showing with 208 additions and 144 deletions.
  1. +15 −15 .github/workflows/static.yml
  2. +8 −8 .github/workflows/tests.yml
  3. +7 −7 Makefile
  4. +7 −7 UPGRADING.md
  5. +9 −2 composer.json
  6. +0 −2 phpstan.src.neon.dist
  7. +0 −5 psalm-baseline.xml
  8. +8 −1 src/Parser/EntryParser.php
  9. +5 −3 src/Parser/Lines.php
  10. +1 −0 src/Parser/Parser.php
  11. +4 −4 src/Repository/Adapter/ApacheAdapter.php
  12. +4 −4 src/Repository/Adapter/ArrayAdapter.php
  13. +9 −7 src/Repository/Adapter/EnvConstAdapter.php
  14. +4 −4 src/Repository/Adapter/GuardedWriter.php
  15. +4 −4 src/Repository/Adapter/ImmutableWriter.php
  16. +1 −1 src/Repository/Adapter/MultiReader.php
  17. +3 −3 src/Repository/Adapter/MultiWriter.php
  18. +4 −4 src/Repository/Adapter/PutenvAdapter.php
  19. +1 −1 src/Repository/Adapter/ReaderInterface.php
  20. +4 −4 src/Repository/Adapter/ReplacingWriter.php
  21. +9 −7 src/Repository/Adapter/ServerConstAdapter.php
  22. +3 −3 src/Repository/Adapter/WriterInterface.php
  23. +20 −1 src/Repository/AdapterRepository.php
  24. +1 −1 src/Repository/RepositoryBuilder.php
  25. +6 −0 src/Repository/RepositoryInterface.php
  26. +3 −1 src/Util/Regex.php
  27. +9 −1 tests/Dotenv/DotenvTest.php
  28. +6 −6 tests/Dotenv/Parser/EntryParserTest.php
  29. +1 −26 tests/Dotenv/Parser/LinesTest.php
  30. +1 −1 tests/Dotenv/Repository/Adapter/EnvConstAdapterTest.php
  31. +1 −1 tests/Dotenv/Repository/Adapter/ServerConstAdapterTest.php
  32. +33 −3 tests/Dotenv/Repository/RepositoryTest.php
  33. +5 −0 tests/fixtures/env/multiline.env
  34. +2 −0 tests/fixtures/env/unicodevarnames.env
  35. +8 −5 vendor-bin/phpstan/composer.json
  36. +2 −2 vendor-bin/psalm/composer.json
30 changes: 15 additions & 15 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -7,28 +7,28 @@ on:
jobs:
phpstan_src:
name: PHPStan Source
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
tools: composer:v2
coverage: none

- name: Install Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Install PHPStan
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
@@ -39,28 +39,28 @@ jobs:

phpstan_tests:
name: PHPStan Tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
tools: composer:v2
coverage: none

- name: Install Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Install PHPStan
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
@@ -71,28 +71,28 @@ jobs:

psalm:
name: Psalm
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
tools: composer:v2
coverage: none

- name: Install Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Install Psalm
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
16 changes: 8 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -7,15 +7,15 @@ on:
jobs:
latest:
name: PHP ${{ matrix.php }} Latest
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -28,7 +28,7 @@ jobs:
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install Latest Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
@@ -39,15 +39,15 @@ jobs:

lowest:
name: PHP ${{ matrix.php }} Lowest
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -60,7 +60,7 @@ jobs:
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install Lowest Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
install:
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:7.4-base update
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:7.4-base bin all update
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.2-base update
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.2-base bin all update

phpunit:
@rm -f bootstrap/cache/*.php && docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:7.4-cli
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.2-cli

phpstan-analyze-src:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:7.4-cli analyze src -c phpstan.src.neon.dist
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.2-cli analyze src -c phpstan.src.neon.dist

phpstan-analyze-tests:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:7.4-cli analyze tests -c phpstan.tests.neon.dist
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.2-cli analyze tests -c phpstan.tests.neon.dist

psalm-analyze:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:7.4-cli
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.2-cli

psalm-baseline:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:7.4-cli --set-baseline=psalm-baseline.xml

psalm-show-info:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:7.4-cli --show-info=true
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.2-cli --show-info=true

test: phpunit phpstan-analyze-src phpstan-analyze-tests psalm-analyze

14 changes: 7 additions & 7 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -10,8 +10,8 @@ Release notes for 5.0.0 are available [here](https://github.com/vlucas/phpdotenv

### Details

1. The `Dotenv\Dotenv::createImmutable` and `Dotenv\Dotenv::createMutable` methods no longer call will result in `getenv` and `putenv` being called. One should instead use `Dotenv\Dotenv::createUnsafeImmutable` and `Dotenv\Dotenv::createUnsafeMutable` methods if one really needs these functions.
2. The `Dotenv\Dotenv` constructor has been modified to expect exactly 4 parameters: a store, a parser, a loader, and a repository. This likely only affect many people, since it is more common to construct this class via the public static create methods. Those methods have not changed.
1. The `Dotenv\Dotenv::createImmutable` and `Dotenv\Dotenv::createMutable` methods no longer call will result in `getenv` and `putenv` being called. One should instead use `Dotenv\Dotenv::createUnsafeImmutable` and `Dotenv\Dotenv::createUnsafeMutable` methods, if one really needs these functions.
2. The `Dotenv\Dotenv` constructor has been modified to expect exactly 4 parameters: a store, a parser, a loader, and a repository. This likely won't affect many people, since it is more common to construct this class via the public static create methods. Those methods have not changed.
3. Scalar typehints have been added to the public interface.
4. The parser now returns a result type instead of raising an exception. This change is strictly internal, and most users won't notice a difference. The responsibility for raising an exception has simply been shifted up to the caller.
5. Adapters have been refactored again, with changes to the repositories. In particular, the repository builder has been tweaked. It now expects to be explicitly told if you want to use the default adapters or not, and expects individual readers and writers to be added, one by one. Similar changes have been applied to the store factory. Moreover, the `ApacheAdapter` has been changed so that it behaves much like the other adapters. The old behaviour can be simulated by composing it with the new `ReplacingWriter` (see below). We will no longer include this adapter in our default setup, so that people can enable exactly what they need. Finally, by default, we will no longer be using the `PutenvAdapter`. It can be added, as required.
@@ -78,18 +78,18 @@ Release notes for 4.0.0 are available [here](https://github.com/vlucas/phpdotenv

### Details

V4 has again changed the way you initialize the `Dotenv` class. If you want immutable loading of environment variables, then replace `Dotenv::create` with `Dotenv::createImmutable`, and if you want mutable loading, replace `Dotenv::create` with `Dotenv::createMutable` and `->overload()` with `->load()`. The `overload` method has been removed in faviour of specifying mutability at object construction.
V4 has again changed the way you initialize the `Dotenv` class. If you want immutable loading of environment variables, then replace `Dotenv::create` with `Dotenv::createImmutable`, and if you want mutable loading, replace `Dotenv::create` with `Dotenv::createMutable` and `->overload()` with `->load()`. The `overload` method has been removed in favour of specifying mutability at object construction.

The behaviour when parsing single quoted strings has now changed, to mimic the behaviour of bash. It is no longer possible to escape characters in single quoted strings, and everything is treated literally. As soon as the first single quote character is read, after the initial one, then the variable is treated as ending immediately at that point. When parsing unquoted or double quoted strings, it is now possible to escape dollar signs, to forcefully avoid variable interpolation. Escaping dollars is not mandated, in the sense that if a dollar is present, and not following by variable interpolation sytnax, this is allowed, and the dollar will be treated as a literal dollar. Finally, interpolation of variables is now performed right to left, instead of left to right, so it is possible to nest interpolations to allow using the value of a variable as the name of another for further interpolation.
The behaviour when parsing single quoted strings has now changed, to mimic the behaviour of bash. It is no longer possible to escape characters in single quoted strings, and everything is treated literally. As soon as the first single quote character is read, after the initial one, then the variable is treated as ending immediately at that point. When parsing unquoted or double quoted strings, it is now possible to escape dollar signs, to forcefully avoid variable interpolation. Escaping dollars is not mandated, in the sense that if a dollar is present, and not following by variable interpolation syntax, this is allowed, and the dollar will be treated as a literal dollar. Finally, interpolation of variables is now performed right to left, instead of left to right, so it is possible to nest interpolations to allow using the value of a variable as the name of another for further interpolation.

The `getEnvironmentVariableNames` method is no longer available. This is because calls to `load()` (since v3.0.0) return an associative array of what was loaded, so `$dotenv->getEnvironmentVariableNames()` can be replaced with `array_keys($dotenv->load())`.

There have been various internal refactorings. Appart from what has already been mentioned, the only other changes likely to affect developers is:
There have been various internal refactorings. Apart from what has already been mentioned, the only other changes likely to affect developers is:

1. The `Dotenv\Environment` namespace has been moved to `Dotenv\Repository`, the `Dotenv\Environment\Adapter\AdapterInterface` interface has been replaced by `Dotenv\Repository\Adapter\ReaderInterface` and `Dotenv\Repository\Adapter\WriterInterface`.
2. The `Dotenv\Environment\DotenvFactory` has been (roughly) replaced by `Dotenv\Repository\RepositoryBuilder`, and `Dotenv\Environment\FactoryInterface` has been deleted.
3. `Dotenv\Environment\AbstractVariables` has been replaced by `Dotenv\Repository\AbstractRepository`, `Dotenv\Environment\DotenvVariables` has been replaced by `Dotenv\Repository\AdapterRepository`, and `Dotenv\Environment\VariablesInterface` has been replaced by `Dotenv\Repository\RepositoryInterface`.
4. The `Dotenv\Loader` class has been moved to `Dotenv\Loader\Loader`, and now has a different public interface. It no longer expects any parameters at construction, and implements only the new interface `Dotenv\Loader\LoaderInterface`. Its reponsibility has changed to purely taking raw env file content, and handing it off to the parser, dealing with variable interpolation, and sending off instructions to the repository to set variables. No longer can it be used as a way to read the environment by callers, and nor does it track immutability.
4. The `Dotenv\Loader` class has been moved to `Dotenv\Loader\Loader`, and now has a different public interface. It no longer expects any parameters at construction, and implements only the new interface `Dotenv\Loader\LoaderInterface`. Its responsibility has changed to purely taking raw env file content, and handing it off to the parser, dealing with variable interpolation, and sending off instructions to the repository to set variables. No longer can it be used as a way to read the environment by callers, and nor does it track immutability.
5. The `Dotenv\Parser` and `Dotenv\Lines` classes have moved to `Dotenv\Loader\Parser` and `Dotenv\Loader\Lines`, respectively. `Dotenv\Loader\Parser::parse` now return has either `null` or `Dotenv\Loader\Value` objects as values, instead of `string`s. This is to support the new variable interpolation and dollar escaping features.
6. The `Dotenv\Validator` constructor has changed from `__construct(array $variables, Loader $loader, $required = true)` to `__construct(RepositoryInterface $repository, array $variables, $required = true)`.

@@ -136,7 +136,7 @@ $repository = RepositoryBuilder::create()
$variables = (new Loader())->load($repository, $content);
```

Notice, that compared to v3, the loader no longer expects file paths in the constructor. Reading of the files is now managed by the `Dotenv\Dotenv` class. The loader is geuinely just loading the content into the repository.
Notice, that compared to v3, the loader no longer expects file paths in the constructor. Reading of the files is now managed by the `Dotenv\Dotenv` class. The loader is genuinely just loading the content into the repository.

Finally, we note that the minimum supported version of PHP has increased to 5.5.9, up from 5.4.0 in V3 and 5.3.9 in V2.

11 changes: 9 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
"require-dev": {
"ext-filter": "*",
"bamarni/composer-bin-plugin": "^1.4.1",
"phpunit/phpunit": "^7.5.20 || ^8.5.21 || ^9.5.10"
"phpunit/phpunit": "^7.5.20 || ^8.5.30 || ^9.5.25"
},
"autoload": {
"psr-4": {
@@ -43,11 +43,18 @@
"ext-filter": "Required to use the boolean validator."
},
"config": {
"allow-plugins": {
"bamarni/composer-bin-plugin": true
},
"preferred-install": "dist"
},
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": true
},
"branch-alias": {
"dev-master": "5.4-dev"
"dev-master": "5.5-dev"
}
}
}
2 changes: 0 additions & 2 deletions phpstan.src.neon.dist
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@ parameters:
level: max
ignoreErrors:
- '#Only booleans are allowed in a negated boolean, int\|false given.#'
- '#Method Dotenv\\Util\\Regex::split\(\) should return GrahamCampbell\\ResultType\\Result\<array\<string\>, string\> but returns GrahamCampbell\\ResultType\\Result\<array\<int, bool\|string\>, string\>.#'
- '#Anonymous function should return GrahamCampbell\\ResultType\\Result\<array\{mixed, mixed\}, string\> but returns GrahamCampbell\\ResultType\\Result\<array\{Dotenv\\Parser\\Value, mixed\}, string\>.#'
- '#Anonymous function should return GrahamCampbell\\ResultType\\Result\<non\-empty\-array, string\> but returns GrahamCampbell\\ResultType\\Result\<non\-empty\-array\<int, Dotenv\\Parser\\Entry\>, string\>.#'
- '#Parameter \#1 \$readers of class Dotenv\\Repository\\RepositoryBuilder constructor expects array\<Dotenv\\Repository\\Adapter\\ReaderInterface\>, array\<Dotenv\\Repository\\Adapter\\ReaderInterface\|S\> given\.#'
- '#Parameter \#2 \$writers of class Dotenv\\Repository\\RepositoryBuilder constructor expects array\<Dotenv\\Repository\\Adapter\\WriterInterface\>, array\<Dotenv\\Repository\\Adapter\\WriterInterface\|S\> given\.#'
5 changes: 0 additions & 5 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.x-dev@">
<file src="src/Parser/EntryParser.php">
<InvalidArgument occurrences="1">
<code>flatMap</code>
</InvalidArgument>
</file>
<file src="src/Repository/RepositoryBuilder.php">
<InvalidStringClass occurrences="3">
<code>$adapter::create()</code>
9 changes: 8 additions & 1 deletion src/Parser/EntryParser.php
Original file line number Diff line number Diff line change
@@ -74,6 +74,7 @@ private static function splitStringIntoParts(string $line)
})->getOrElse([$line, null]);

if ($result[0] === '') {
/** @var \GrahamCampbell\ResultType\Result<array{string,string|null},string> */
return Error::create(self::getErrorMessage('an unexpected equals', $line));
}

@@ -102,9 +103,11 @@ private static function parseName(string $name)
}

if (!self::isValidName($name)) {
/** @var \GrahamCampbell\ResultType\Result<string,string> */
return Error::create(self::getErrorMessage('an invalid name', $name));
}

/** @var \GrahamCampbell\ResultType\Result<string,string> */
return Success::create($name);
}

@@ -136,7 +139,7 @@ private static function isQuotedName(string $name)
*/
private static function isValidName(string $name)
{
return Regex::matches('~\A[a-zA-Z0-9_.]+\z~', $name)->success()->getOrElse(false);
return Regex::matches('~(*UTF8)\A[\p{Ll}\p{Lu}\p{M}\p{N}_.]+\z~', $name)->success()->getOrElse(false);
}

/**
@@ -154,6 +157,7 @@ private static function isValidName(string $name)
private static function parseValue(string $value)
{
if (\trim($value) === '') {
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value,string> */
return Success::create(Value::blank());
}

@@ -164,10 +168,13 @@ private static function parseValue(string $value)
});
});
}, Success::create([Value::blank(), self::INITIAL_STATE]))->flatMap(static function (array $result) {
/** @psalm-suppress DocblockTypeContradiction */
if (in_array($result[1], self::REJECT_STATES, true)) {
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value,string> */
return Error::create('a missing closing quote');
}

/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value,string> */
return Success::create($result[0]);
})->mapError(static function (string $err) use ($value) {
return self::getErrorMessage($err, $value);
Loading