Skip to content

Commit b674e23

Browse files
Merge branch '4.3'
2 parents c7e5327 + c349cad commit b674e23

File tree

13 files changed

+49
-45
lines changed

13 files changed

+49
-45
lines changed

.github/workflows/static.yml

+15-15
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ on:
77
jobs:
88
phpstan_src:
99
name: PHPStan Source
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111

1212
steps:
1313
- name: Checkout code
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1515

1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: 7.4
19+
php-version: 8.2
2020
tools: composer:v2
2121
coverage: none
2222

2323
- name: Install Dependencies
24-
uses: nick-invision/retry@v1
24+
uses: nick-invision/retry@v2
2525
with:
2626
timeout_minutes: 5
2727
max_attempts: 5
2828
command: composer update --no-interaction --no-progress
2929

3030
- name: Install PHPStan
31-
uses: nick-invision/retry@v1
31+
uses: nick-invision/retry@v2
3232
with:
3333
timeout_minutes: 5
3434
max_attempts: 5
@@ -39,28 +39,28 @@ jobs:
3939

4040
phpstan_tests:
4141
name: PHPStan Tests
42-
runs-on: ubuntu-20.04
42+
runs-on: ubuntu-22.04
4343

4444
steps:
4545
- name: Checkout code
46-
uses: actions/checkout@v2
46+
uses: actions/checkout@v3
4747

4848
- name: Setup PHP
4949
uses: shivammathur/setup-php@v2
5050
with:
51-
php-version: 7.4
51+
php-version: 8.2
5252
tools: composer:v2
5353
coverage: none
5454

5555
- name: Install Dependencies
56-
uses: nick-invision/retry@v1
56+
uses: nick-invision/retry@v2
5757
with:
5858
timeout_minutes: 5
5959
max_attempts: 5
6060
command: composer update --no-interaction --no-progress
6161

6262
- name: Install PHPStan
63-
uses: nick-invision/retry@v1
63+
uses: nick-invision/retry@v2
6464
with:
6565
timeout_minutes: 5
6666
max_attempts: 5
@@ -71,28 +71,28 @@ jobs:
7171

7272
psalm:
7373
name: Psalm
74-
runs-on: ubuntu-20.04
74+
runs-on: ubuntu-22.04
7575

7676
steps:
7777
- name: Checkout code
78-
uses: actions/checkout@v2
78+
uses: actions/checkout@v3
7979

8080
- name: Setup PHP
8181
uses: shivammathur/setup-php@v2
8282
with:
83-
php-version: 7.4
83+
php-version: 8.2
8484
tools: composer:v2
8585
coverage: none
8686

8787
- name: Install Dependencies
88-
uses: nick-invision/retry@v1
88+
uses: nick-invision/retry@v2
8989
with:
9090
timeout_minutes: 5
9191
max_attempts: 5
9292
command: composer update --no-interaction --no-progress
9393

9494
- name: Install Psalm
95-
uses: nick-invision/retry@v1
95+
uses: nick-invision/retry@v2
9696
with:
9797
timeout_minutes: 5
9898
max_attempts: 5

.github/workflows/tests.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ on:
77
jobs:
88
latest:
99
name: PHP ${{ matrix.php }} Latest
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111

1212
strategy:
1313
matrix:
14-
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
14+
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
1515

1616
steps:
1717
- name: Checkout Code
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v3
1919

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

3030
- name: Install Latest Dependencies
31-
uses: nick-invision/retry@v1
31+
uses: nick-invision/retry@v2
3232
with:
3333
timeout_minutes: 5
3434
max_attempts: 5
@@ -39,15 +39,15 @@ jobs:
3939

4040
lowest:
4141
name: PHP ${{ matrix.php }} Lowest
42-
runs-on: ubuntu-20.04
42+
runs-on: ubuntu-22.04
4343

4444
strategy:
4545
matrix:
46-
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
46+
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
4747

4848
steps:
4949
- name: Checkout Code
50-
uses: actions/checkout@v2
50+
uses: actions/checkout@v3
5151

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

6262
- name: Install Lowest Dependencies
63-
uses: nick-invision/retry@v1
63+
uses: nick-invision/retry@v2
6464
with:
6565
timeout_minutes: 5
6666
max_attempts: 5

Makefile

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
install:
2-
@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
3-
@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
2+
@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
3+
@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
44

55
phpunit:
6-
@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
6+
@rm -f bootstrap/cache/*.php && docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.2-cli
77

88
phpstan-analyze-src:
9-
@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
9+
@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
1010

1111
phpstan-analyze-tests:
12-
@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
12+
@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
1313

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

1717
psalm-baseline:
1818
@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
1919

2020
psalm-show-info:
21-
@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
21+
@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
2222

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

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"require-dev": {
2828
"ext-filter": "*",
2929
"bamarni/composer-bin-plugin": "^1.4.1",
30-
"phpunit/phpunit": "^7.5.20 || ^8.5.21 || ^9.5.10"
30+
"phpunit/phpunit": "^7.5.20 || ^8.5.30 || ^9.5.25"
3131
},
3232
"autoload": {
3333
"psr-4": {
@@ -54,7 +54,7 @@
5454
"forward-command": true
5555
},
5656
"branch-alias": {
57-
"dev-master": "5.4-dev"
57+
"dev-master": "5.5-dev"
5858
}
5959
}
6060
}

phpstan.src.neon.dist

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ parameters:
22
level: max
33
ignoreErrors:
44
- '#Only booleans are allowed in a negated boolean, int\|false given.#'
5-
- '#Method Dotenv\\Util\\Regex::split\(\) should return GrahamCampbell\\ResultType\\Result\<array\<string\>, string\> but returns GrahamCampbell\\ResultType\\Result\<array\<int, bool\|string\>, string\>.#'
65
- '#Anonymous function should return GrahamCampbell\\ResultType\\Result\<array\{mixed, mixed\}, string\> but returns GrahamCampbell\\ResultType\\Result\<array\{Dotenv\\Parser\\Value, mixed\}, string\>.#'
7-
- '#Anonymous function should return GrahamCampbell\\ResultType\\Result\<non\-empty\-array, string\> but returns GrahamCampbell\\ResultType\\Result\<non\-empty\-array\<int, Dotenv\\Parser\\Entry\>, string\>.#'
86
- '#Parameter \#1 \$readers of class Dotenv\\Repository\\RepositoryBuilder constructor expects array\<Dotenv\\Repository\\Adapter\\ReaderInterface\>, array\<Dotenv\\Repository\\Adapter\\ReaderInterface\|S\> given\.#'
97
- '#Parameter \#2 \$writers of class Dotenv\\Repository\\RepositoryBuilder constructor expects array\<Dotenv\\Repository\\Adapter\\WriterInterface\>, array\<Dotenv\\Repository\\Adapter\\WriterInterface\|S\> given\.#'

psalm-baseline.xml

-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<files psalm-version="4.x-dev@">
3-
<file src="src/Parser/EntryParser.php">
4-
<InvalidArgument occurrences="1">
5-
<code>flatMap</code>
6-
</InvalidArgument>
7-
</file>
83
<file src="src/Repository/RepositoryBuilder.php">
94
<InvalidStringClass occurrences="3">
105
<code>$adapter::create()</code>

src/Parser/EntryParser.php

+6
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ private static function splitStringIntoParts(string $line)
7474
})->getOrElse([$line, null]);
7575

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

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

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

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

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

@@ -166,9 +170,11 @@ private static function parseValue(string $value)
166170
}, Success::create([Value::blank(), self::INITIAL_STATE]))->flatMap(static function (array $result) {
167171
/** @psalm-suppress DocblockTypeContradiction */
168172
if (in_array($result[1], self::REJECT_STATES, true)) {
173+
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value,string> */
169174
return Error::create('a missing closing quote');
170175
}
171176

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

src/Parser/Parser.php

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ private static function process(array $entries)
4444
return \array_reduce($entries, static function (Result $result, string $raw) {
4545
return $result->flatMap(static function (array $entries) use ($raw) {
4646
return EntryParser::parse($raw)->map(static function (Entry $entry) use ($entries) {
47+
/** @var \Dotenv\Parser\Entry[] */
4748
return \array_merge($entries, [$entry]);
4849
});
4950
});

src/Repository/Adapter/EnvConstAdapter.php

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function read(string $name)
5353
return 'true';
5454
}
5555

56+
/** @psalm-suppress PossiblyInvalidCast */
5657
return (string) $value;
5758
});
5859
}

src/Repository/Adapter/ServerConstAdapter.php

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function read(string $name)
5353
return 'true';
5454
}
5555

56+
/** @psalm-suppress PossiblyInvalidCast */
5657
return (string) $value;
5758
});
5859
}

src/Util/Regex.php

+2
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ private static function pregAndWrap(callable $operation, string $subject)
102102
$result = $operation($subject);
103103

104104
if (\preg_last_error() !== \PREG_NO_ERROR) {
105+
/** @var \GrahamCampbell\ResultType\Result<V,string> */
105106
return Error::create(\preg_last_error_msg());
106107
}
107108

109+
/** @var \GrahamCampbell\ResultType\Result<V,string> */
108110
return Success::create($result);
109111
}
110112
}

vendor-bin/phpstan/composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"require": {
3-
"php": "^7.4",
4-
"phpstan/phpstan": "1.2.0",
3+
"php": "^8.2",
4+
"phpstan/phpstan": "1.8.9",
55
"phpstan/extension-installer": "1.1.0",
66
"phpstan/phpstan-deprecation-rules": "1.0.0",
7-
"phpstan/phpstan-phpunit": "1.0.0",
8-
"phpstan/phpstan-strict-rules": "1.1.0",
7+
"phpstan/phpstan-phpunit": "1.1.1",
8+
"phpstan/phpstan-strict-rules": "1.4.4",
99
"thecodingmachine/phpstan-strict-rules": "1.0.0"
1010
},
1111
"config": {

vendor-bin/psalm/composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"require": {
3-
"php": "^7.4",
4-
"psalm/phar": "4.19.0"
3+
"php": "^8.2",
4+
"psalm/phar": "4.29.0"
55
},
66
"config": {
77
"preferred-install": "dist"

0 commit comments

Comments
 (0)