Skip to content

Added support for PHP 8.1 #496

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

Merged
merged 2 commits into from
Oct 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']

steps:
- name: Checkout Code
Expand All @@ -27,21 +27,12 @@ jobs:
- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install PHP 5/7 Dependencies
- name: Install 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-req=php
if: "matrix.php >= 8"

- name: Execute PHPUnit
run: vendor/bin/phpunit
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.phpunit.result.cache
composer.lock
phpunit.xml
vendor
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
"authors": [
{
"name": "Graham Campbell",
"email": "[email protected]",
"homepage": "https://gjcampbell.co.uk/"
"email": "[email protected]"
},
{
"name": "Vance Lucas",
"email": "[email protected]",
"homepage": "https://vancelucas.com/"
"email": "[email protected]"
}
],
"require": {
Expand All @@ -22,7 +20,7 @@
"require-dev": {
"ext-filter": "*",
"ext-pcre": "*",
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20"
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 2 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
beStrictAboutOutputDuringTests="true"
bootstrap="vendor/autoload.php"
colors="true"
convertDeprecationsToExceptions="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
failOnWarning="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
Expand Down
12 changes: 8 additions & 4 deletions src/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ protected function ensureFileIsReadable()
* - cleaning the name of quotes,
* - resolving nested variables.
*
* @param string $name
* @param string $value
* @param string $name
* @param string|null $value
*
* @throws \Dotenv\Exception\InvalidFileException
*
Expand All @@ -138,15 +138,19 @@ protected function normaliseEnvironmentVariable($name, $value)
*
* Called from `normaliseEnvironmentVariable` and the `VariableFactory`, passed as a callback in `$this->loadFromFile()`.
*
* @param string $name
* @param string $value
* @param string $name
* @param string|null $value
*
* @throws \Dotenv\Exception\InvalidFileException
*
* @return array
*/
public function processFilters($name, $value)
{
if ($value === null) {
$value = '';
}

list($name, $value) = $this->splitCompoundStringIntoParts($name, $value);
list($name, $value) = $this->sanitiseVariableName($name, $value);
list($name, $value) = $this->sanitiseVariableValue($name, $value);
Expand Down
5 changes: 4 additions & 1 deletion tests/Dotenv/DotenvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class DotenvTest extends TestCase
*/
private $fixturesFolder;

public function setUp()
/**
* @before
*/
public function setUpTest()
{
$this->fixturesFolder = dirname(__DIR__).'/fixtures/env';
}
Expand Down
5 changes: 4 additions & 1 deletion tests/Dotenv/LoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ class LoaderTest extends TestCase
*/
private $mutableLoader;

public function setUp()
/**
* @before
*/
public function setUpTest()
{
$folder = dirname(__DIR__).'/fixtures/env';

Expand Down
5 changes: 4 additions & 1 deletion tests/Dotenv/ValidatorBooleanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class ValidatorBooleanTest extends TestCase
*/
private $fixturesFolder;

public function setUp()
/**
* @before
*/
public function setUpTest()
{
$this->fixturesFolder = dirname(__DIR__).'/fixtures/env';
}
Expand Down