Skip to content

Commit

Permalink
Merge branch '4.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Oct 15, 2022
2 parents c7e5327 + c349cad commit b674e23
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 45 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ on:
jobs:
phpstan_src:
name: PHPStan Source
runs-on: ubuntu-20.04

This comment has been minimized.

Copy link
@BalaqiiAmin

BalaqiiAmin Sep 4, 2023

-gjhmnthang

runs-on: ubuntu-22.04

steps:
- name: Checkout code

This comment has been minimized.

Copy link
@BalaqiiAmin

BalaqiiAmin Sep 4, 2023

Ebasitho
thierno

This comment has been minimized.

Copy link
@BalaqiiAmin
uses: actions/checkout@v2
uses: actions/checkout@v3

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

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

- name: Install PHPStan
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
Expand All @@ -39,28 +39,28 @@ jobs:

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

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

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

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

- name: Install PHPStan
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
Expand All @@ -71,28 +71,28 @@ jobs:

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

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

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

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

- name: Install Psalm
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ on:
jobs:
latest:
name: PHP ${{ matrix.php }} Latest
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

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

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

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

- name: Install Latest Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
Expand All @@ -39,15 +39,15 @@ jobs:

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

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

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

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

- name: Install Lowest Dependencies
uses: nick-invision/retry@v1
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
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
@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
@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

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
@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

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
@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

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
@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

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

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

psalm-show-info:
@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
@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

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

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"require-dev": {
"ext-filter": "*",
"bamarni/composer-bin-plugin": "^1.4.1",
"phpunit/phpunit": "^7.5.20 || ^8.5.21 || ^9.5.10"
"phpunit/phpunit": "^7.5.20 || ^8.5.30 || ^9.5.25"
},
"autoload": {
"psr-4": {
Expand All @@ -54,7 +54,7 @@
"forward-command": true
},
"branch-alias": {
"dev-master": "5.4-dev"
"dev-master": "5.5-dev"
}
}
}
2 changes: 0 additions & 2 deletions phpstan.src.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ parameters:
level: max
ignoreErrors:
- '#Only booleans are allowed in a negated boolean, int\|false given.#'
- '#Method Dotenv\\Util\\Regex::split\(\) should return GrahamCampbell\\ResultType\\Result\<array\<string\>, string\> but returns GrahamCampbell\\ResultType\\Result\<array\<int, bool\|string\>, string\>.#'
- '#Anonymous function should return GrahamCampbell\\ResultType\\Result\<array\{mixed, mixed\}, string\> but returns GrahamCampbell\\ResultType\\Result\<array\{Dotenv\\Parser\\Value, mixed\}, string\>.#'
- '#Anonymous function should return GrahamCampbell\\ResultType\\Result\<non\-empty\-array, string\> but returns GrahamCampbell\\ResultType\\Result\<non\-empty\-array\<int, Dotenv\\Parser\\Entry\>, string\>.#'
- '#Parameter \#1 \$readers of class Dotenv\\Repository\\RepositoryBuilder constructor expects array\<Dotenv\\Repository\\Adapter\\ReaderInterface\>, array\<Dotenv\\Repository\\Adapter\\ReaderInterface\|S\> given\.#'
- '#Parameter \#2 \$writers of class Dotenv\\Repository\\RepositoryBuilder constructor expects array\<Dotenv\\Repository\\Adapter\\WriterInterface\>, array\<Dotenv\\Repository\\Adapter\\WriterInterface\|S\> given\.#'

This comment has been minimized.

Copy link
@BalaqiiAmin

BalaqiiAmin Sep 4, 2023

yes given

5 changes: 0 additions & 5 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.x-dev@">

This comment has been minimized.

Copy link
@BalaqiiAmin

BalaqiiAmin Sep 4, 2023

may us

<file src="src/Parser/EntryParser.php">
<InvalidArgument occurrences="1">
<code>flatMap</code>
</InvalidArgument>
</file>
<file src="src/Repository/RepositoryBuilder.php">
<InvalidStringClass occurrences="3">
<code>$adapter::create()</code>
Expand Down
6 changes: 6 additions & 0 deletions src/Parser/EntryParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ private static function splitStringIntoParts(string $line)
})->getOrElse([$line, null]);

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

Expand Down Expand Up @@ -102,9 +103,11 @@ private static function parseName(string $name)
}

This comment has been minimized.

Copy link
@BalaqiiAmin

BalaqiiAmin Sep 5, 2023

ikjo(100
)


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

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

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

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

/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value,string> */
return Success::create($result[0]);
})->mapError(static function (string $err) use ($value) {
return self::getErrorMessage($err, $value);
Expand Down
1 change: 1 addition & 0 deletions src/Parser/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ private static function process(array $entries)
return \array_reduce($entries, static function (Result $result, string $raw) {
return $result->flatMap(static function (array $entries) use ($raw) {
return EntryParser::parse($raw)->map(static function (Entry $entry) use ($entries) {
/** @var \Dotenv\Parser\Entry[] */
return \array_merge($entries, [$entry]);
});
});
Expand Down
1 change: 1 addition & 0 deletions src/Repository/Adapter/EnvConstAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function read(string $name)
return 'true';
}

/** @psalm-suppress PossiblyInvalidCast */
return (string) $value;
});
}
Expand Down
1 change: 1 addition & 0 deletions src/Repository/Adapter/ServerConstAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function read(string $name)
return 'true';
}

/** @psalm-suppress PossiblyInvalidCast */
return (string) $value;
});
}
Expand Down
2 changes: 2 additions & 0 deletions src/Util/Regex.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ private static function pregAndWrap(callable $operation, string $subject)
$result = $operation($subject);

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

/** @var \GrahamCampbell\ResultType\Result<V,string> */
return Success::create($result);
}
}
8 changes: 4 additions & 4 deletions vendor-bin/phpstan/composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"require": {
"php": "^7.4",
"phpstan/phpstan": "1.2.0",
"php": "^8.2",
"phpstan/phpstan": "1.8.9",
"phpstan/extension-installer": "1.1.0",
"phpstan/phpstan-deprecation-rules": "1.0.0",
"phpstan/phpstan-phpunit": "1.0.0",
"phpstan/phpstan-strict-rules": "1.1.0",
"phpstan/phpstan-phpunit": "1.1.1",
"phpstan/phpstan-strict-rules": "1.4.4",
"thecodingmachine/phpstan-strict-rules": "1.0.0"
},
"config": {
Expand Down
4 changes: 2 additions & 2 deletions vendor-bin/psalm/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"require": {
"php": "^7.4",
"psalm/phar": "4.19.0"
"php": "^8.2",
"psalm/phar": "4.29.0"
},
"config": {
"preferred-install": "dist"
Expand Down

0 comments on commit b674e23

Please sign in to comment.