Skip to content

Commit f1e2a35

Browse files
Added support for PHP 8.1 (#496)
1 parent b786088 commit f1e2a35

File tree

8 files changed

+28
-24
lines changed

8 files changed

+28
-24
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
strategy:
1313
matrix:
14-
php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
14+
php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
1515

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

30-
- name: Install PHP 5/7 Dependencies
30+
- name: Install Dependencies
3131
uses: nick-invision/retry@v1
3232
with:
3333
timeout_minutes: 5
3434
max_attempts: 5
3535
command: composer update --no-interaction --no-progress
36-
if: "matrix.php < 8"
37-
38-
- name: Install PHP 8 Dependencies
39-
uses: nick-invision/retry@v1
40-
with:
41-
timeout_minutes: 5
42-
max_attempts: 5
43-
command: composer update --no-interaction --no-progress --ignore-platform-req=php
44-
if: "matrix.php >= 8"
4536

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.phpunit.result.cache
12
composer.lock
23
phpunit.xml
34
vendor

composer.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
"authors": [
77
{
88
"name": "Graham Campbell",
9-
"email": "[email protected]",
10-
"homepage": "https://gjcampbell.co.uk/"
9+
"email": "[email protected]"
1110
},
1211
{
1312
"name": "Vance Lucas",
14-
"email": "[email protected]",
15-
"homepage": "https://vancelucas.com/"
13+
"email": "[email protected]"
1614
}
1715
],
1816
"require": {
@@ -22,7 +20,7 @@
2220
"require-dev": {
2321
"ext-filter": "*",
2422
"ext-pcre": "*",
25-
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20"
23+
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21"
2624
},
2725
"autoload": {
2826
"psr-4": {

phpunit.xml.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
beStrictAboutOutputDuringTests="true"
66
bootstrap="vendor/autoload.php"
77
colors="true"
8+
convertDeprecationsToExceptions="true"
89
convertErrorsToExceptions="true"
910
convertNoticesToExceptions="true"
1011
convertWarningsToExceptions="true"
1112
failOnRisky="true"
12-
failOnWarning="true"
13+
failOnWarning="false"
1314
processIsolation="false"
1415
stopOnError="false"
1516
stopOnFailure="false"

src/Loader.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ protected function ensureFileIsReadable()
117117
* - cleaning the name of quotes,
118118
* - resolving nested variables.
119119
*
120-
* @param string $name
121-
* @param string $value
120+
* @param string $name
121+
* @param string|null $value
122122
*
123123
* @throws \Dotenv\Exception\InvalidFileException
124124
*
@@ -138,15 +138,19 @@ protected function normaliseEnvironmentVariable($name, $value)
138138
*
139139
* Called from `normaliseEnvironmentVariable` and the `VariableFactory`, passed as a callback in `$this->loadFromFile()`.
140140
*
141-
* @param string $name
142-
* @param string $value
141+
* @param string $name
142+
* @param string|null $value
143143
*
144144
* @throws \Dotenv\Exception\InvalidFileException
145145
*
146146
* @return array
147147
*/
148148
public function processFilters($name, $value)
149149
{
150+
if ($value === null) {
151+
$value = '';
152+
}
153+
150154
list($name, $value) = $this->splitCompoundStringIntoParts($name, $value);
151155
list($name, $value) = $this->sanitiseVariableName($name, $value);
152156
list($name, $value) = $this->sanitiseVariableValue($name, $value);

tests/Dotenv/DotenvTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ class DotenvTest extends TestCase
1010
*/
1111
private $fixturesFolder;
1212

13-
public function setUp()
13+
/**
14+
* @before
15+
*/
16+
public function setUpTest()
1417
{
1518
$this->fixturesFolder = dirname(__DIR__).'/fixtures/env';
1619
}

tests/Dotenv/LoaderTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ class LoaderTest extends TestCase
1515
*/
1616
private $mutableLoader;
1717

18-
public function setUp()
18+
/**
19+
* @before
20+
*/
21+
public function setUpTest()
1922
{
2023
$folder = dirname(__DIR__).'/fixtures/env';
2124

tests/Dotenv/ValidatorBooleanTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ class ValidatorBooleanTest extends TestCase
1010
*/
1111
private $fixturesFolder;
1212

13-
public function setUp()
13+
/**
14+
* @before
15+
*/
16+
public function setUpTest()
1417
{
1518
$this->fixturesFolder = dirname(__DIR__).'/fixtures/env';
1619
}

0 commit comments

Comments
 (0)