Skip to content

Commit 0635a71

Browse files
committed
:octocat: PHP 8.1 compatibility
1 parent 313b95a commit 0635a71

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
# https://github.com/sebastianbergmann/phpunit/blob/master/.github/workflows/ci.yml
33

44
on:
5-
- pull_request
6-
- push
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
711

812
name: "CI"
913

@@ -20,7 +24,7 @@ jobs:
2024

2125
steps:
2226
- name: "Checkout"
23-
uses: actions/checkout@v2
27+
uses: actions/checkout@v3
2428

2529
- name: "Install PHP"
2630
uses: shivammathur/setup-php@v2
@@ -50,22 +54,21 @@ jobs:
5054
php-version:
5155
- "7.4"
5256
- "8.0"
57+
- "8.1"
5358

5459
steps:
5560
- name: "Configure git to avoid issues with line endings"
5661
if: matrix.os == 'windows-latest'
5762
run: git config --global core.autocrlf false
5863

5964
- name: "Checkout"
60-
uses: actions/checkout@v2
65+
uses: actions/checkout@v3
6166

6267
- name: "Install PHP with extensions"
6368
uses: shivammathur/setup-php@v2
6469
with:
6570
php-version: ${{ matrix.php-version }}
6671
coverage: pcov
67-
# extensions:
68-
# ini-values:
6972

7073
- name: "Install dependencies with composer"
7174
run: composer update --no-ansi --no-interaction --no-progress --no-suggest
@@ -74,6 +77,4 @@ jobs:
7477
run: php vendor/bin/phpunit --configuration=phpunit.xml
7578

7679
- name: "Send code coverage report to Codecov.io"
77-
uses: codecov/codecov-action@v1
78-
with:
79-
token: ${{ secrets.CODECOV_TOKEN }}
80+
uses: codecov/codecov-action@v3

composer.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"php": "^7.4 || ^8.0"
2424
},
2525
"require-dev": {
26-
"phan/phan": "^4.1",
26+
"phan/phan": "^5.3",
2727
"phpunit/phpunit": "^9.5"
2828
},
2929
"autoload": {
@@ -35,5 +35,14 @@
3535
"psr-4": {
3636
"chillerlan\\DotEnvTest\\": "tests/"
3737
}
38+
},
39+
"scripts": {
40+
"phpunit": "@php vendor/bin/phpunit",
41+
"phan": "@php vendor/bin/phan"
42+
},
43+
"config": {
44+
"lock": false,
45+
"sort-packages": true,
46+
"platform-check": true
3847
}
3948
}

src/DotEnv.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace chillerlan\DotEnv;
1414

1515
use function apache_getenv, apache_setenv, array_key_exists, array_map, explode, file, function_exists, getenv, implode,
16-
in_array, ini_get, ini_set, is_array, is_file, is_numeric, is_readable, preg_replace, preg_replace_callback, putenv,
16+
in_array, is_array, is_file, is_numeric, is_readable, preg_replace, preg_replace_callback, putenv,
1717
rtrim, strpos, strtoupper, trim;
1818

1919
use const DIRECTORY_SEPARATOR, FILE_IGNORE_NEW_LINES, FILE_SKIP_EMPTY_LINES, PHP_EOL;
@@ -226,11 +226,7 @@ protected function read(string $file):array{
226226
throw new DotEnvException('invalid file: '.$file);
227227
}
228228

229-
// Read file into an array of lines with auto-detected line endings
230-
$autodetect = ini_get('auto_detect_line_endings');
231-
ini_set('auto_detect_line_endings', '1');
232229
$lines = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
233-
ini_set('auto_detect_line_endings', $autodetect);
234230

235231
if(!is_array($lines) || empty($lines)){
236232
throw new DotEnvException('error while reading file: '.$file);

0 commit comments

Comments
 (0)