Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move request provider code to a separate package + Raise PHP to 8.1 #26

Merged
merged 13 commits into from
Mar 2, 2024
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
os: >-
['ubuntu-latest', 'windows-latest']
php: >-
['8.0', '8.1', '8.2', '8.3']
['8.1', '8.2', '8.3']
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.1', '8.2', '8.3']
2 changes: 1 addition & 1 deletion .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.2']
['8.3']
secrets:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1', '8.2', '8.3']
['8.1', '8.2', '8.3']
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
"url": "https://github.com/sponsors/yiisoft"
}
],
"minimum-stability": "dev",
arogachev marked this conversation as resolved.
Show resolved Hide resolved
vjik marked this conversation as resolved.
Show resolved Hide resolved
"require": {
"php": "^8.0",
"php": "^8.1",
"psr/container": "^1.0|^2.0",
"psr/http-message": "^1.0|^2.0",
"psr/http-server-handler": "^1.0",
Expand All @@ -41,7 +42,8 @@
"yiisoft/hydrator": "^1.0",
"yiisoft/hydrator-validator": "^1.0",
"yiisoft/middleware-dispatcher": "^5.1",
"yiisoft/validator": "^1.1"
"yiisoft/validator": "^1.1",
"yiisoft/request-provider": "^1.0"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.4",
Expand Down
9 changes: 0 additions & 9 deletions config/di-web.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,11 @@

use Yiisoft\Definitions\Reference;
use Yiisoft\Hydrator\Validator\ValidatingHydrator;
use Yiisoft\Input\Http\Request\RequestProvider;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\Input\Http\RequestInputParametersResolver;

/** @var array $params */

return [
RequestProviderInterface::class => [
'class' => RequestProvider::class,
'reset' => function () {
/** @var RequestProvider $this */
$this->request = null;
},
],
RequestInputParametersResolver::class => [
'__construct()' => [
'hydrator' => Reference::to(ValidatingHydrator::class),
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Data/FromBodyResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Yiisoft\Hydrator\Attribute\Data\DataAttributeResolverInterface;
use Yiisoft\Hydrator\AttributeHandling\Exception\UnexpectedAttributeException;
use Yiisoft\Hydrator\DataInterface;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\RequestProvider\RequestProviderInterface;

use function is_array;

Expand Down
3 changes: 2 additions & 1 deletion src/Attribute/Data/FromQueryResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
use Yiisoft\Hydrator\Attribute\Data\DataAttributeResolverInterface;
use Yiisoft\Hydrator\AttributeHandling\Exception\UnexpectedAttributeException;
use Yiisoft\Hydrator\DataInterface;
use Yiisoft\Input\Http\Request\RequestProviderInterface;

use Yiisoft\RequestProvider\RequestProviderInterface;

use function is_array;

Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Parameter/BodyResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Yiisoft\Hydrator\AttributeHandling\Exception\UnexpectedAttributeException;
use Yiisoft\Hydrator\AttributeHandling\ParameterAttributeResolveContext;
use Yiisoft\Hydrator\Result;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\RequestProvider\RequestProviderInterface;

use function is_array;

Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Parameter/QueryResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Yiisoft\Hydrator\AttributeHandling\ParameterAttributeResolveContext;
use Yiisoft\Hydrator\Attribute\Parameter\ParameterAttributeInterface;
use Yiisoft\Hydrator\Result;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\RequestProvider\RequestProviderInterface;

/**
* Resolver for {@see Query} attribute.
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Parameter/RequestResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Yiisoft\Hydrator\AttributeHandling\Exception\UnexpectedAttributeException;
use Yiisoft\Hydrator\AttributeHandling\ParameterAttributeResolveContext;
use Yiisoft\Hydrator\Result;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\RequestProvider\RequestProviderInterface;

/**
* Resolver for {@see Request} attribute.
Expand Down
4 changes: 2 additions & 2 deletions src/Attribute/Parameter/UploadedFilesResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Yiisoft\Hydrator\AttributeHandling\Exception\UnexpectedAttributeException;
use Yiisoft\Hydrator\AttributeHandling\ParameterAttributeResolveContext;
use Yiisoft\Hydrator\Result;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\RequestProvider\RequestProviderInterface;

/**
* Resolver for {@see UploadedFiles} attribute.
Expand All @@ -21,7 +21,7 @@ final class UploadedFilesResolver implements ParameterAttributeResolverInterface
* @param RequestProviderInterface $requestProvider The request provider.
*/
public function __construct(
private RequestProviderInterface $requestProvider
private RequestProviderInterface $requestProvider,
) {
}

Expand Down
32 changes: 0 additions & 32 deletions src/Request/Catcher/RequestCatcherMiddleware.php

This file was deleted.

33 changes: 0 additions & 33 deletions src/Request/Catcher/RequestCatcherParametersResolver.php

This file was deleted.

21 changes: 0 additions & 21 deletions src/Request/RequestNotSetException.php

This file was deleted.

32 changes: 0 additions & 32 deletions src/Request/RequestProvider.php

This file was deleted.

27 changes: 0 additions & 27 deletions src/Request/RequestProviderInterface.php

This file was deleted.

4 changes: 2 additions & 2 deletions tests/Attribute/Data/FromBodyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
use Yiisoft\Input\Http\Attribute\Data\FromBody;
use Yiisoft\Input\Http\Attribute\Data\FromBodyResolver;
use Yiisoft\Input\Http\Attribute\Data\FromQuery;
use Yiisoft\Input\Http\Request\RequestProvider;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\Input\Http\Tests\Support\Input\FromBodyInput;
use Yiisoft\Input\Http\Tests\Support\Input\FromBodyNestedInput;
use Yiisoft\Input\Http\Tests\Support\TestHelper;
use Yiisoft\RequestProvider\RequestProvider;
use Yiisoft\RequestProvider\RequestProviderInterface;

final class FromBodyTest extends TestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Attribute/Data/FromQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
use Yiisoft\Input\Http\Attribute\Data\FromBody;
use Yiisoft\Input\Http\Attribute\Data\FromQuery;
use Yiisoft\Input\Http\Attribute\Data\FromQueryResolver;
use Yiisoft\Input\Http\Request\RequestProvider;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\Input\Http\Tests\Support\Input\FromQueryInput;
use Yiisoft\Input\Http\Tests\Support\Input\FromQueryNestedInput;
use Yiisoft\Input\Http\Tests\Support\TestHelper;
use Yiisoft\RequestProvider\RequestProvider;
use Yiisoft\RequestProvider\RequestProviderInterface;

final class FromQueryTest extends TestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Attribute/Parameter/BodyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
use Yiisoft\Input\Http\Attribute\Parameter\Body;
use Yiisoft\Input\Http\Attribute\Parameter\BodyResolver;
use Yiisoft\Input\Http\Attribute\Parameter\Query;
use Yiisoft\Input\Http\Request\RequestProvider;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\Input\Http\Tests\Support\TestHelper;
use Yiisoft\RequestProvider\RequestProvider;
use Yiisoft\RequestProvider\RequestProviderInterface;

final class BodyTest extends TestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Attribute/Parameter/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
use Yiisoft\Input\Http\Attribute\Parameter\Body;
use Yiisoft\Input\Http\Attribute\Parameter\Query;
use Yiisoft\Input\Http\Attribute\Parameter\QueryResolver;
use Yiisoft\Input\Http\Request\RequestProvider;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\Input\Http\Tests\Support\TestHelper;
use Yiisoft\RequestProvider\RequestProvider;
use Yiisoft\RequestProvider\RequestProviderInterface;

final class QueryTest extends TestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Attribute/Parameter/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
use Yiisoft\Input\Http\Attribute\Parameter\Body;
use Yiisoft\Input\Http\Attribute\Parameter\Request;
use Yiisoft\Input\Http\Attribute\Parameter\RequestResolver;
use Yiisoft\Input\Http\Request\RequestProvider;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\Input\Http\Tests\Support\TestHelper;
use Yiisoft\RequestProvider\RequestProvider;
use Yiisoft\RequestProvider\RequestProviderInterface;

final class RequestTest extends TestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Attribute/Parameter/UploadedFilesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
use Yiisoft\Input\Http\Attribute\Parameter\Body;
use Yiisoft\Input\Http\Attribute\Parameter\UploadedFiles;
use Yiisoft\Input\Http\Attribute\Parameter\UploadedFilesResolver;
use Yiisoft\Input\Http\Request\RequestProvider;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\Input\Http\Tests\Support\TestHelper;
use Yiisoft\RequestProvider\RequestProvider;
use Yiisoft\RequestProvider\RequestProviderInterface;

final class UploadedFilesTest extends TestCase
{
Expand Down
7 changes: 4 additions & 3 deletions tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
use Yiisoft\Di\StateResetter;
use Yiisoft\Hydrator\Hydrator;
use Yiisoft\Hydrator\HydratorInterface;
use Yiisoft\Input\Http\Request\RequestNotSetException;
use Yiisoft\Input\Http\Request\RequestProvider;
use Yiisoft\Input\Http\Request\RequestProviderInterface;
use Yiisoft\Input\Http\RequestInputParametersResolver;
use Yiisoft\RequestProvider\RequestNotSetException;
use Yiisoft\RequestProvider\RequestProvider;
use Yiisoft\RequestProvider\RequestProviderInterface;
use Yiisoft\Validator\Validator;
use Yiisoft\Validator\ValidatorInterface;

Expand Down Expand Up @@ -60,6 +60,7 @@ private function getContainerDefinitions(array|null $params = null): array
}

return array_merge(
require dirname(__DIR__) . '/vendor/yiisoft/request-provider/config/di-web.php',
require dirname(__DIR__) . '/config/di-web.php',
[
HydratorInterface::class => Hydrator::class,
Expand Down
2 changes: 1 addition & 1 deletion tests/HydratorAttributeParametersResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
use Yiisoft\Input\Http\Attribute\Parameter\Query;
use Yiisoft\Input\Http\Attribute\Parameter\QueryResolver;
use Yiisoft\Input\Http\HydratorAttributeParametersResolver;
use Yiisoft\Input\Http\Request\RequestProvider;
use Yiisoft\Input\Http\Tests\Support\CallableTypeCaster;
use Yiisoft\Input\Http\Tests\Support\TestHelper;
use Yiisoft\RequestProvider\RequestProvider;

final class HydratorAttributeParametersResolverTest extends TestCase
{
Expand Down
Loading
Loading