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.0.0
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.0.1
Choose a head ref

Commits on Jun 7, 2020

  1. Fixed phpstan

    GrahamCampbell committed Jun 7, 2020

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    dd27e89 View commit details
  2. Merge branch '4.1'

    GrahamCampbell committed Jun 7, 2020

    Unverified

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

Commits on Jun 25, 2020

  1. Update .travis.yml

    GrahamCampbell authored Jun 25, 2020

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    972fe2c 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
    32a35ac 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
    4f75ea0 View commit details
  4. Merge branch '4.1'

    GrahamCampbell committed Jun 25, 2020

    Verified

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

Commits on Jul 1, 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
    c2da544 View commit details

Commits on Jul 14, 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
    2cf2a5a View commit details
  2. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    17d6adc View commit details
  3. Copy the full SHA
    0cf3ece View commit details
  4. Copy the full SHA
    8b75630 View commit details
  5. Tweaks

    GrahamCampbell committed Jul 14, 2020
    Copy the full SHA
    e1d57f6 View commit details
  6. Copy the full SHA
    5955b06 View commit details
  7. Copy the full SHA
    4cb8faf View commit details
  8. Copy the full SHA
    4e49927 View commit details
  9. Copy the full SHA
    691a433 View commit details
  10. Copy the full SHA
    d4c24c3 View commit details
  11. Copy the full SHA
    8e2176f View commit details
  12. Copy the full SHA
    7da90f2 View commit details
  13. Copy the full SHA
    f24e406 View commit details
  14. Copy the full SHA
    d8d60d5 View commit details
  15. Copy the full SHA
    70756fb View commit details
  16. Update CONTRIBUTING.md

    GrahamCampbell committed Jul 14, 2020
    Copy the full SHA
    2065bed View commit details
  17. Copy the full SHA
    a0fe44d View commit details
  18. Update composer.json

    GrahamCampbell committed Jul 14, 2020
    Copy the full SHA
    9f032f5 View commit details
  19. Copy the full SHA
    f129fff View commit details
  20. Copy the full SHA
    40126db View commit details
  21. Copy the full SHA
    556e60c View commit details
  22. Revert "Update composer.json"

    This reverts commit 9f032f5.
    GrahamCampbell committed Jul 14, 2020
    Copy the full SHA
    99f3e12 View commit details
  23. Copy the full SHA
    d6992fc View commit details
  24. Revert "Revert "Update composer.json""

    This reverts commit 99f3e12.
    GrahamCampbell committed Jul 14, 2020
    Copy the full SHA
    90f2751 View commit details
  25. Fixes

    GrahamCampbell committed Jul 14, 2020
    Copy the full SHA
    809f161 View commit details
  26. Fixed indentation

    GrahamCampbell committed Jul 14, 2020
    Copy the full SHA
    572af79 View commit details
  27. Copy the full SHA
    331dea7 View commit details
  28. Copy the full SHA
    7e6837d View commit details
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -5,10 +5,11 @@
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/.github export-ignore
/phpstan.neon.dist export-ignore
/phpstan.tests.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
/README.md export-ignore
/UPGRADING.md export-ignore
/vendor-bin export-ignore
10 changes: 5 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ We accept contributions via pull requests on Github. Please review these guideli

## Guidelines

* Please follow the [PSR-2 Coding Style Guide](https://www.php-fig.org/psr/psr-2/)..
* Please follow the [PSR-2 Coding Style Guide](https://www.php-fig.org/psr/psr-2/).
* Ensure that the current tests pass, and if you've added something new, add the tests where relevant.
* Send a coherent commit history, making sure each individual commit in your pull request is meaningful.
* You may need to [rebase](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) to avoid merge conflicts.
@@ -18,13 +18,13 @@ We accept contributions via pull requests on Github. Please review these guideli
First, install the dependencies using [Composer](https://getcomposer.org/):

```bash
$ composer install
$ make install
```

Then run [PHPUnit](https://phpunit.de/):
Then run [PHPUnit](https://phpunit.de/) and the static analyzers:

```bash
$ vendor/bin/phpunit
$ make test
```

The tests will be automatically run by [Travis CI](https://travis-ci.org/) against pull requests.
These will also be automatically run by [GitHub Actions](https://github.com/features/actions) against pull requests.
102 changes: 102 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Static Analysis

on:
push:
pull_request:

jobs:
phpstan_src:
name: PHPStan Source
runs-on: ubuntu-20.04

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

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

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

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

- name: Execute PHPStan
run: vendor/bin/phpstan analyze src -c phpstan.src.neon.dist --no-progress

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

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

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

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

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

- name: Execute PHPStan
run: vendor/bin/phpstan analyze tests -c phpstan.tests.neon.dist --no-progress

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

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

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

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

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

- name: Execute Psalm
run: vendor/bin/psalm --no-progress --output-format=github
79 changes: 79 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Tests

on:
push:
pull_request:

jobs:
tests_latest:
name: PHP ${{ matrix.php }} Latest
runs-on: ubuntu-20.04

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

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none

- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install PHP 5/7 Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress
if: "matrix.php < 8"

- name: Install PHP 8 Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress --ignore-platform-reqs
if: "matrix.php >= 8"

- name: Execute PHPUnit
run: vendor/bin/phpunit

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

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

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none

- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

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

- name: Execute PHPUnit
run: vendor/bin/phpunit
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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

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

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

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

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

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

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

clean:
@rm -rf .phpunit.result.cache composer.lock vendor vendor-bin/*/composer.lock vendor-bin/*/vendor
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` au
![Banner](https://user-images.githubusercontent.com/2829600/71564012-31105580-2a91-11ea-9ad7-ef1278411b35.png)

<p align="center">
<a href="https://travis-ci.org/vlucas/phpdotenv"><img src="https://img.shields.io/travis/vlucas/phpdotenv/master.svg?style=flat-square" alt="Build Status"></img></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-BSD%203--Clause-brightgreen.svg?style=flat-square" alt="Software License"></img></a>
<a href="https://packagist.org/packages/vlucas/phpdotenv"><img src="https://img.shields.io/packagist/dt/vlucas/phpdotenv.svg?style=flat-square" alt="Total Downloads"></img></a>
<a href="https://github.com/vlucas/phpdotenv/releases"><img src="https://img.shields.io/github/release/vlucas/phpdotenv.svg?style=flat-square" alt="Latest Version"></img></a>
7 changes: 2 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -43,14 +43,11 @@
"ext-filter": "Required to use the boolean validator."
},
"config": {
"preferred-install": "dist",
"platform-check": false
"preferred-install": "dist"
},
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
2 changes: 0 additions & 2 deletions phpstan.src.neon.dist
Original file line number Diff line number Diff line change
@@ -3,6 +3,4 @@ parameters:
ignoreErrors:
- '#Unable to resolve the template type#'
- '#Anonymous function should have native return typehint ".+".#'
- '#Method Dotenv\\Parser\\EntryParser::processToken\(\) should return GrahamCampbell\\ResultType\\Result<array.+, string> but returns GrahamCampbell\\ResultType\\Result<array.+, mixed>.#'
- '#Parameter \#1 \$callable of method PhpOption\\Option<bool\|string>::flatMap\(\) expects callable\(bool\|string\): PhpOption\\Option<mixed>, Closure\(string\): mixed given.#'
- '#Only booleans are allowed in a negated boolean, int\|false given.#'
12 changes: 12 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
</projectFiles>
</psalm>
28 changes: 26 additions & 2 deletions src/Parser/EntryParser.php
Original file line number Diff line number Diff line change
@@ -48,6 +48,7 @@ public static function parse(string $entry)
[$name, $value] = $parts;

return self::parseName($name)->flatMap(static function (string $name) use ($value) {
/** @var Result<Value|null,string> */
$parsedValue = $value === null ? Success::create(null) : self::parseValue($value);

return $parsedValue->map(static function (?Value $value) use ($name) {
@@ -91,8 +92,8 @@ private static function splitStringIntoParts(string $line)
*/
private static function parseName(string $name)
{
if (Str::len($name) > 8 && Str::substr($name, 0, 6) === 'export' && ctype_space(Str::substr($name, 6, 1))) {
$name = ltrim(Str::substr($name, 6));
if (Str::len($name) > 8 && Str::substr($name, 0, 6) === 'export' && \ctype_space(Str::substr($name, 6, 1))) {
$name = \ltrim(Str::substr($name, 6));
}

if (self::isQuotedName($name)) {
@@ -181,64 +182,87 @@ private static function processToken(int $state, string $token)
switch ($state) {
case self::INITIAL_STATE:
if ($token === '\'') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create(['', false, self::SINGLE_QUOTED_STATE]);
} elseif ($token === '"') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create(['', false, self::DOUBLE_QUOTED_STATE]);
} elseif ($token === '#') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create(['', false, self::COMMENT_STATE]);
} elseif ($token === '$') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create([$token, true, self::UNQUOTED_STATE]);
} else {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create([$token, false, self::UNQUOTED_STATE]);
}
case self::UNQUOTED_STATE:
if ($token === '#') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create(['', false, self::COMMENT_STATE]);
} elseif (\ctype_space($token)) {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create(['', false, self::WHITESPACE_STATE]);
} elseif ($token === '$') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create([$token, true, self::UNQUOTED_STATE]);
} else {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create([$token, false, self::UNQUOTED_STATE]);
}
case self::SINGLE_QUOTED_STATE:
if ($token === '\'') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create(['', false, self::WHITESPACE_STATE]);
} else {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create([$token, false, self::SINGLE_QUOTED_STATE]);
}
case self::DOUBLE_QUOTED_STATE:
if ($token === '"') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create(['', false, self::WHITESPACE_STATE]);
} elseif ($token === '\\') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create(['', false, self::ESCAPE_SEQUENCE_STATE]);
} elseif ($token === '$') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create([$token, true, self::DOUBLE_QUOTED_STATE]);
} else {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]);
}
case self::ESCAPE_SEQUENCE_STATE:
if ($token === '"' || $token === '\\') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]);
} elseif ($token === '$') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]);
} else {
$first = Str::substr($token, 0, 1);
if (\in_array($first, ['f', 'n', 'r', 't', 'v'], true)) {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create([\stripcslashes('\\'.$first).Str::substr($token, 1), false, self::DOUBLE_QUOTED_STATE]);
} else {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Error::create('an unexpected escape sequence');
}
}
case self::WHITESPACE_STATE:
if ($token === '#') {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create(['', false, self::COMMENT_STATE]);
} elseif (!\ctype_space($token)) {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Error::create('unexpected whitespace');
} else {
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create(['', false, self::WHITESPACE_STATE]);
}
case self::COMMENT_STATE:
/** @var \GrahamCampbell\ResultType\Result<array{string,bool,int},string> */
return Success::create(['', false, self::COMMENT_STATE]);
default:
throw new \Error('Parser entered invalid state.');
2 changes: 1 addition & 1 deletion src/Parser/Lexer.php
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ public static function lex(string $content)

while (isset($content[$offset])) {
if (!\preg_match($regex, $content, $matches, 0, $offset)) {
throw new \Error(sprintf('Lexer encountered unexpected character [%s].', $content[$offset]));
throw new \Error(\sprintf('Lexer encountered unexpected character [%s].', $content[$offset]));
}

$offset += \strlen($matches[0]);
2 changes: 1 addition & 1 deletion src/Repository/RepositoryBuilder.php
Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@

use Dotenv\Repository\Adapter\AdapterInterface;
use Dotenv\Repository\Adapter\EnvConstAdapter;
use Dotenv\Repository\Adapter\GuardedWriter;
use Dotenv\Repository\Adapter\ImmutableWriter;
use Dotenv\Repository\Adapter\MultiReader;
use Dotenv\Repository\Adapter\MultiWriter;
use Dotenv\Repository\Adapter\ReaderInterface;
use Dotenv\Repository\Adapter\ServerConstAdapter;
use Dotenv\Repository\Adapter\GuardedWriter;
use Dotenv\Repository\Adapter\WriterInterface;
use InvalidArgumentException;
use PhpOption\Some;
5 changes: 4 additions & 1 deletion src/Store/File/Reader.php
Original file line number Diff line number Diff line change
@@ -69,7 +69,10 @@ public static function read(array $filePaths, bool $shortCircuit = true, string
*/
private static function readFromFile(string $path, string $encoding = null)
{
return Option::fromValue(@\file_get_contents($path), false)->flatMap(static function (string $content) use ($encoding) {
/** @var Option<string> */
$content = Option::fromValue(@\file_get_contents($path), false);

return $content->flatMap(static function (string $content) use ($encoding) {
return Str::utf8($content, $encoding)->mapError(static function (string $error) {
throw new InvalidEncodingException($error);
})->success();
3 changes: 2 additions & 1 deletion src/Util/Regex.php
Original file line number Diff line number Diff line change
@@ -82,6 +82,7 @@ public static function replaceCallback(string $pattern, callable $callback, stri
public static function split(string $pattern, string $subject)
{
return self::pregAndWrap(static function (string $subject) use ($pattern) {
/** @var string[] */
return (array) @\preg_split($pattern, $subject);
}, $subject);
}
@@ -101,7 +102,7 @@ private static function pregAndWrap(callable $operation, string $subject)
$result = $operation($subject);

if (\preg_last_error() !== \PREG_NO_ERROR) {
return Error::create(preg_last_error_msg());
return Error::create(\preg_last_error_msg());
}

return Success::create($result);
5 changes: 4 additions & 1 deletion src/Util/Str.php
Original file line number Diff line number Diff line change
@@ -36,11 +36,13 @@ private function __construct()
public static function utf8(string $input, string $encoding = null)
{
if ($encoding !== null && !\in_array($encoding, \mb_list_encodings(), true)) {
/** @var \GrahamCampbell\ResultType\Result<string,string> */
return Error::create(
\sprintf('Illegal character encoding [%s] specified.', $encoding)
);
}

/** @var \GrahamCampbell\ResultType\Result<string,string> */
return Success::create(
$encoding === null ? @\mb_convert_encoding($input, 'UTF-8') : @\mb_convert_encoding($input, 'UTF-8', $encoding)
);
@@ -55,9 +57,10 @@ public static function utf8(string $input, string $encoding = null)
*/
public static function split(string $input)
{
$result = mb_str_split($input, 1, 'UTF-8');
$result = \mb_str_split($input, 1, 'UTF-8');

if ($result === false) {
/** @var \GrahamCampbell\ResultType\Result<string[],string> */
return Error::create('Multibyte split failed.');
}

2 changes: 1 addition & 1 deletion src/Validator.php
Original file line number Diff line number Diff line change
@@ -167,7 +167,7 @@ private function assert(callable $callback, string $message)

foreach ($this->variables as $variable) {
if ($callback($this->repository->get($variable)) === false) {
$failing[] = \sprintf('%s %s', $variable, $message ?? 'failed callback assertion');
$failing[] = \sprintf('%s %s', $variable, $message);
}
}

4 changes: 2 additions & 2 deletions tests/Dotenv/DotenvTest.php
Original file line number Diff line number Diff line change
@@ -155,8 +155,8 @@ public function testLargeDotenvLoadsEnvironmentVars()
{
$dotenv = Dotenv::createMutable(self::$folder, 'large.env');
$dotenv->load();
self::assertSame(2730, strlen($_SERVER['LARGE']));
self::assertSame(8192, strlen($_SERVER['HUGE']));
self::assertSame(2730, \strlen($_SERVER['LARGE']));
self::assertSame(8192, \strlen($_SERVER['HUGE']));
}

public function testDotenvLoadsMultibyteVars()
2 changes: 1 addition & 1 deletion tests/Dotenv/ValidatorTest.php
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ public static function setFolder()
*
* @return array{\Dotenv\Repository\RepositoryInterface,\Dotenv\Dotenv}
*/
public function createArrayDotenv(string $name = '.env')
public static function createArrayDotenv(string $name = '.env')
{
$repository = RepositoryBuilder::createWithNoAdapters()->addAdapter(ArrayAdapter::class)->make();

15 changes: 9 additions & 6 deletions vendor-bin/phpstan/composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"require": {
"phpstan/phpstan": "^0.12.25",
"phpstan/extension-installer": "^1.0.4",
"phpstan/phpstan-deprecation-rules": "^0.12.4",
"phpstan/phpstan-phpunit": "^0.12.11",
"phpstan/phpstan-strict-rules": "^0.12.2",
"thecodingmachine/phpstan-strict-rules": "^0.12.0"
"phpstan/phpstan": "~0.12.32",
"phpstan/extension-installer": "~1.0.4",
"phpstan/phpstan-deprecation-rules": "~0.12.4",
"phpstan/phpstan-phpunit": "~0.12.11",
"phpstan/phpstan-strict-rules": "~0.12.2",
"thecodingmachine/phpstan-strict-rules": "~0.12.0"
},
"config": {
"preferred-install": "dist"
}
}
8 changes: 8 additions & 0 deletions vendor-bin/psalm/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"require": {
"vimeo/psalm": "~3.12.2"
},
"config": {
"preferred-install": "dist"
}
}