Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
os: >-
['ubuntu-latest', 'windows-latest']
php: >-
['8.0', '8.1', '8.2', '8.3']
['8.0', '8.1', '8.2', '8.3', '8.4']
2 changes: 1 addition & 1 deletion .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1', '8.2', '8.3']
['8.0', '8.1', '8.2', '8.3', '8.4']
2 changes: 1 addition & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.3']
['8.4']
16 changes: 8 additions & 8 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ on:
name: static analysis

jobs:
psalm:
psalm80:
uses: yiisoft/actions/.github/workflows/psalm.yml@master
with:
psalm-config: psalm80.xml
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2']
psalm80:
['8.0']
psalm81-82:
uses: yiisoft/actions/.github/workflows/psalm.yml@master
with:
psalm-config: psalm80.xml
psalm-config: psalm81-82.xml
os: >-
['ubuntu-latest']
php: >-
['8.0']
psalm83:
['8.1', '8.2']
psalm:
uses: yiisoft/actions/.github/workflows/psalm.yml@master
with:
psalm-config: psalm83.xml
os: >-
['ubuntu-latest']
php: >-
['8.3']
['8.3', '8.4']
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1.0.3 under development

- no changes in this release.
- Chg #44: Change PHP constraint in `composer.json` to `8.0 - 8.4` (@vjik)

## 1.0.2 August 06, 2024

Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@
],
"prefer-stable": true,
"require": {
"php": "^8.0",
"php": "8.0 - 8.4",
"ext-filter": "*",
"psr/http-message": "^1.0|^2.0",
"psr/http-message": "^1.0 || ^2.0",
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
"yiisoft/http": "^1.2",
"yiisoft/network-utilities": "^1.1"
},
"require-dev": {
"httpsoft/http-message": "^1.0",
"httpsoft/http-message": "^1.1.6",
"maglnet/composer-require-checker": "^4.4",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.16.0",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.30|^5.24",
"yiisoft/test-support": "^3.0"
"phpunit/phpunit": "^9.6.22",
"rector/rector": "^2.0.10",
"roave/infection-static-analysis-plugin": "^1.25",
"spatie/phpunit-watcher": "^1.23.6",
"vimeo/psalm": "^4.30 || ^5.26.1 || ^6.9.1",
"yiisoft/test-support": "^3.0.2"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="false"
ensureOverrideAttribute="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand All @@ -16,5 +17,6 @@
<issueHandlers>
<MixedAssignment errorLevel="suppress" />
<RiskyTruthyFalsyComparison errorLevel="suppress" />
<MissingClassConstType errorLevel="suppress" />
</issueHandlers>
</psalm>
2 changes: 1 addition & 1 deletion psalm83.xml → psalm81-82.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="false"
ensureOverrideAttribute="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand All @@ -16,6 +17,5 @@
<issueHandlers>
<MixedAssignment errorLevel="suppress" />
<RiskyTruthyFalsyComparison errorLevel="suppress" />
<MissingClassConstType errorLevel="suppress" />
</issueHandlers>
</psalm>
25 changes: 8 additions & 17 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,17 @@

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

// register a single rule
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
]);

$rectorConfig->skip([
])
->withPhpSets(php80: true)
->withRules([
InlineConstructorDefaultToPropertyRector::class,
])
->withSkip([
ClosureToArrowFunctionRector::class,
AddDefaultValueForUndefinedVariableRector::class,
]);
};
9 changes: 7 additions & 2 deletions src/TrustedHostsNetworkResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
* port: ?int,
* ipIdentifier: ?non-empty-string,
* }
*
* @psalm-suppress ClassMustBeFinal We allow to extend this class.
*/
class TrustedHostsNetworkResolver implements MiddlewareInterface
{
Expand Down Expand Up @@ -522,7 +524,7 @@ private function normalizeHeaderName(string $headerName): string
/**
* @psalm-param non-empty-string $remoteAddr
*
* @psalm-return array{0: ForwardedHeaderGroup, 1: list<RawConnectionChainItem>}
* @psalm-return array{0: ForwardedHeaderGroup, 1: non-empty-list<RawConnectionChainItem>}
*
* @throws InvalidConnectionChainItemException
* @throws RfcProxyParseException
Expand Down Expand Up @@ -551,6 +553,9 @@ private function getConnectionChainItems(string $remoteAddr, ServerRequestInterf
}

$items = [];
/**
* @psalm-var non-empty-list<string> $requestIps It needs for PHP 8.0 only
*/
$requestIps = array_merge([$remoteAddr], array_reverse($forwardedHeaderValue));
foreach ($requestIps as $requestIp) {
$items[] = $this->getConnectionChainItem(
Expand Down Expand Up @@ -761,7 +766,7 @@ private function getConnectionChainItem(
}

/**
* @psalm-param list<RawConnectionChainItem> $items
* @psalm-param non-empty-list<RawConnectionChainItem> $items
* @psalm-param list<ConnectionChainItem> $validatedItems
* @psalm-param-out list<ConnectionChainItem> $validatedItems
*
Expand Down