Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
Adopt to new yiisoft/validator (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik authored May 31, 2021
1 parent c03f55a commit 40617f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Middleware/TrustedHostsNetworkResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface

$trustedHostData = null;
$trustedHeaders = [];
$ipValidator = ($this->ipValidator ?? new Ip())->disallowSubnet()->disallowNegation();
$ipValidator = ($this->ipValidator ?? Ip::rule())->disallowSubnet()->disallowNegation();
foreach ($this->trustedHosts as $data) {
// collect all trusted headers
$trustedHeaders = array_merge($trustedHeaders, $data[self::DATA_KEY_TRUSTED_HEADERS]);
Expand Down
2 changes: 1 addition & 1 deletion tests/Middleware/IpFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function setUp(): void
parent::setUp();
$this->responseFactoryMock = $this->createMock(ResponseFactoryInterface::class);
$this->requestHandlerMock = $this->createMock(RequestHandlerInterface::class);
$this->ipFilter = new IpFilter((new Ip())->ranges([self::ALLOWED_IP]), $this->responseFactoryMock);
$this->ipFilter = new IpFilter(Ip::rule()->ranges([self::ALLOWED_IP]), $this->responseFactoryMock);
}

public function testProcessReturnsAccessDeniedResponseWhenIpIsNotAllowed(): void
Expand Down

0 comments on commit 40617f6

Please sign in to comment.