Skip to content

Commit a665e22

Browse files
authored
Merge pull request #216 from KentarouTakeda/update-dependencies-and-fix-bc
Update dependencies and fix BC accordingly
2 parents bccdd3f + 04be298 commit a665e22

17 files changed

+45
-44
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
"php": ">=7.2",
2525
"ext-json": "*",
2626
"devizzent/cebe-php-openapi": "^1.0",
27-
"league/uri": "^6.3",
27+
"league/uri": "^6.3 || ^7.0",
2828
"psr/cache": "^1.0 || ^2.0 || ^3.0",
29-
"psr/http-message": "^1.0",
29+
"psr/http-message": "^1.0 || ^2.0",
3030
"psr/http-server-middleware": "^1.0",
3131
"respect/validation": "^1.1.3 || ^2.0",
3232
"riverline/multipart-parser": "^2.0.3",
@@ -35,8 +35,8 @@
3535
},
3636
"require-dev": {
3737
"doctrine/coding-standard": "^8.0",
38-
"guzzlehttp/psr7": "^1.5",
39-
"hansott/psr7-cookies": "^3.0.2",
38+
"guzzlehttp/psr7": "^2.0",
39+
"hansott/psr7-cookies": "^3.0.2 || ^4.0",
4040
"phpstan/extension-installer": "^1.0",
4141
"phpstan/phpstan": "^1",
4242
"phpstan/phpstan-phpunit": "^1",

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ parameters:
55
- src
66
- tests
77
treatPhpDocTypesAsCertain: false
8+
reportUnmatchedIgnoredErrors: false
89
ignoreErrors:
910
- '#Call to an undefined static method Respect\\Validation\\Validator::numeric\(\).#'

src/Schema/TypeFormats/StringURI.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class StringURI
1212
public function __invoke(string $value): bool
1313
{
1414
try {
15+
// namespace 'League\Uri' is provided by multiple packages, but PHPStan does not support merging them
16+
// @phpstan-ignore-next-line
1517
UriString::parse($value);
1618

1719
return true;

tests/FromCommunity/EmptyObjectValidationTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
namespace League\OpenAPIValidation\Tests\FromCommunity;
66

77
use GuzzleHttp\Psr7\ServerRequest;
8+
use GuzzleHttp\Psr7\Utils;
89
use League\OpenAPIValidation\PSR7\ValidatorBuilder;
910
use PHPUnit\Framework\TestCase;
1011

11-
use function GuzzleHttp\Psr7\stream_for;
12-
1312
final class EmptyObjectValidationTest extends TestCase
1413
{
1514
/**
@@ -40,7 +39,7 @@ public function testIssue57000(): void
4039

4140
$psrRequest = (new ServerRequest('post', 'http://localhost:8000/api/v1/products.create'))
4241
->withHeader('Content-Type', 'application/json')
43-
->withBody(stream_for('{}'));
42+
->withBody(Utils::streamFor('{}'));
4443

4544
$validator->validate($psrRequest);
4645

tests/FromCommunity/Issue12Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
namespace League\OpenAPIValidation\Tests\FromCommunity;
66

77
use GuzzleHttp\Psr7\ServerRequest;
8+
use GuzzleHttp\Psr7\Utils;
89
use League\OpenAPIValidation\PSR7\ValidatorBuilder;
910
use PHPUnit\Framework\TestCase;
1011

11-
use function GuzzleHttp\Psr7\stream_for;
1212
use function json_encode;
1313

1414
final class Issue12Test extends TestCase
@@ -61,7 +61,7 @@ public function testIssue12(?array $example): void
6161

6262
$psrRequest = (new ServerRequest('post', 'http://localhost:8000/api/v1/products.create'))
6363
->withHeader('Content-Type', 'application/json')
64-
->withBody(stream_for(json_encode(['test' => $example])));
64+
->withBody(Utils::streamFor(json_encode(['test' => $example])));
6565

6666
$validator->validate($psrRequest);
6767

tests/FromCommunity/Issue32Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
namespace League\OpenAPIValidation\Tests\FromCommunity;
66

77
use GuzzleHttp\Psr7\ServerRequest;
8+
use GuzzleHttp\Psr7\Utils;
89
use League\OpenAPIValidation\PSR7\Exception\ValidationFailed;
910
use League\OpenAPIValidation\PSR7\ValidatorBuilder;
1011
use PHPUnit\Framework\TestCase;
1112

12-
use function GuzzleHttp\Psr7\stream_for;
1313
use function json_encode;
1414

1515
final class Issue32Test extends TestCase
@@ -51,7 +51,7 @@ enum:
5151

5252
$psrRequest = (new ServerRequest('post', 'http://localhost:8000/api/test/create'))
5353
->withHeader('Content-Type', 'application/json')
54-
->withBody(stream_for(json_encode($data)));
54+
->withBody(Utils::streamFor(json_encode($data)));
5555

5656
$serverRequestValidator = (new ValidatorBuilder())->fromYaml($yaml)->getServerRequestValidator();
5757

tests/FromCommunity/Issue3Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
namespace League\OpenAPIValidation\Tests\FromCommunity;
66

77
use GuzzleHttp\Psr7\ServerRequest;
8+
use GuzzleHttp\Psr7\Utils;
89
use League\OpenAPIValidation\PSR7\ValidatorBuilder;
910
use PHPUnit\Framework\TestCase;
1011

11-
use function GuzzleHttp\Psr7\stream_for;
1212
use function json_encode;
1313

1414
final class Issue3Test extends TestCase
@@ -52,7 +52,7 @@ public function testIssue3(): void
5252

5353
$psrRequest = (new ServerRequest('post', 'http://localhost:8000/api/v1/products.create'))
5454
->withHeader('Content-Type', 'application/json')
55-
->withBody(stream_for(json_encode(['test' => 20])));
55+
->withBody(Utils::streamFor(json_encode(['test' => 20])));
5656

5757
$validator->validate($psrRequest);
5858

tests/FromCommunity/Issue50Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
namespace League\OpenAPIValidation\Tests\FromCommunity;
66

77
use GuzzleHttp\Psr7\ServerRequest;
8+
use GuzzleHttp\Psr7\Utils;
89
use League\OpenAPIValidation\PSR7\Exception\Validation\InvalidBody;
910
use League\OpenAPIValidation\PSR7\ValidatorBuilder;
1011
use League\OpenAPIValidation\Schema\Exception\KeywordMismatch;
1112
use PHPUnit\Framework\TestCase;
1213

13-
use function GuzzleHttp\Psr7\stream_for;
1414
use function json_encode;
1515

1616
final class Issue50Test extends TestCase
@@ -54,7 +54,7 @@ public function testIssue50(): void
5454
$psrRequest = (new ServerRequest('post', 'http://localhost:8000/api/v1/products.create'))
5555
->withHeader('Content-Type', 'application/json')
5656
->withBody(
57-
stream_for(
57+
Utils::streamFor(
5858
json_encode(
5959
[
6060
'body' =>

tests/FromCommunity/Issue57Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
namespace League\OpenAPIValidation\Tests\FromCommunity;
66

77
use GuzzleHttp\Psr7\ServerRequest;
8+
use GuzzleHttp\Psr7\Utils;
89
use League\OpenAPIValidation\PSR7\ValidatorBuilder;
910
use PHPUnit\Framework\TestCase;
1011

11-
use function GuzzleHttp\Psr7\stream_for;
1212
use function json_encode;
1313

1414
final class Issue57Test extends TestCase
@@ -60,7 +60,7 @@ public function testIssue57(): void
6060

6161
$psrRequest = (new ServerRequest('post', 'http://localhost:8000/api/v1/products.create'))
6262
->withHeader('Content-Type', 'application/json')
63-
->withBody(stream_for(json_encode(['test' => (object) ['some_property_here' => (object) []]])));
63+
->withBody(Utils::streamFor(json_encode(['test' => (object) ['some_property_here' => (object) []]])));
6464

6565
$validator->validate($psrRequest);
6666

tests/PSR7/BaseValidatorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
use GuzzleHttp\Psr7\Response;
99
use GuzzleHttp\Psr7\ServerRequest;
1010
use GuzzleHttp\Psr7\Uri;
11+
use GuzzleHttp\Psr7\Utils;
1112
use HansOtt\PSR7Cookies\SetCookie;
1213
use InvalidArgumentException;
1314
use PHPUnit\Framework\TestCase;
1415
use Psr\Http\Message\RequestInterface;
1516
use Psr\Http\Message\ResponseInterface;
1617
use Psr\Http\Message\ServerRequestInterface;
1718

18-
use function GuzzleHttp\Psr7\stream_for;
1919
use function json_encode;
2020
use function sprintf;
2121

@@ -33,7 +33,7 @@ protected function makeGoodResponse(string $path, string $method): ResponseInter
3333
return (new Response())
3434
->withHeader('Content-Type', 'application/json')
3535
->withHeader('Header-B', 'good value')
36-
->withBody(stream_for(json_encode($body)));
36+
->withBody(Utils::streamFor(json_encode($body)));
3737

3838
case 'post /cookies':
3939
$response = (new Response())
@@ -72,7 +72,7 @@ protected function makeGoodServerRequest(string $path, string $method): ServerRe
7272

7373
return $request
7474
->withHeader('Content-Type', 'application/json')
75-
->withBody(stream_for(json_encode($body)));
75+
->withBody(Utils::streamFor(json_encode($body)));
7676

7777
default:
7878
throw new InvalidArgumentException(sprintf("unexpected operation '%s %s''", $method, $path));
@@ -104,7 +104,7 @@ protected function makeGoodRequest(string $path, string $method): RequestInterfa
104104

105105
return $request
106106
->withHeader('Content-Type', 'application/json')
107-
->withBody(stream_for(json_encode($body)));
107+
->withBody(Utils::streamFor(json_encode($body)));
108108

109109
default:
110110
throw new InvalidArgumentException(sprintf("unexpected operation '%s %s''", $method, $path));

0 commit comments

Comments
 (0)