From 3e77766f152420e7b5d7ac732f6a7772a4e48977 Mon Sep 17 00:00:00 2001 From: N'Bayramberdiyev Date: Mon, 4 Apr 2022 23:35:25 +0300 Subject: [PATCH 1/5] drop support for PHP 7.3 --- .github/workflows/tests.yml | 2 +- README.md | 2 +- composer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bcefae6..2f50731 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - php: [7.3, 7.4, 8.0, 8.1] + php: [7.4, 8.0, 8.1] experimental: [false] include: - php: 8.1 diff --git a/README.md b/README.md index c9a8214..d836fe1 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ $ composer require slim/http ``` This will install the `slim/http` component and all required dependencies. -PHP 7.3, or newer, is required. +PHP 7.4, or newer, is required. ## Tests diff --git a/composer.json b/composer.json index 37f0a2b..a0e60aa 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ } ], "require": { - "php": "^7.3 || ^8.0", + "php": "^7.4 || ^8.0", "ext-SimpleXML": "*", "ext-fileinfo": "*", "ext-json": "*", From 78612d034f72f26e4284c5858971f3b5750425ed Mon Sep 17 00:00:00 2001 From: N'Bayramberdiyev Date: Mon, 4 Apr 2022 23:36:05 +0300 Subject: [PATCH 2/5] upgrade CI dependencies --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2f50731..30df493 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up PHP ${{ matrix.php }} uses: shivammathur/setup-php@v2 @@ -27,7 +27,7 @@ jobs: coverage: xdebug - name: Install dependencies with Composer - uses: ramsey/composer-install@v1 + uses: ramsey/composer-install@v2 - name: Coding standards if: matrix.analysis From fa709b43b60b155a8a2fae37557244f8c14ebcae Mon Sep 17 00:00:00 2001 From: N'Bayramberdiyev Date: Mon, 4 Apr 2022 23:36:51 +0300 Subject: [PATCH 3/5] indent with 4 spaces --- composer.json | 134 ++++++++++++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 65 deletions(-) diff --git a/composer.json b/composer.json index a0e60aa..ca70cf9 100644 --- a/composer.json +++ b/composer.json @@ -1,71 +1,75 @@ { - "name": "slim/http", - "type": "library", - "description": "Slim PSR-7 Object Decorators", - "keywords": ["psr7", "psr-7", "http"], - "homepage": "http://slimframework.com", - "license": "MIT", - "authors": [ - { - "name": "Josh Lockhart", - "email": "hello@joshlockhart.com", - "homepage": "http://joshlockhart.com" + "name": "slim/http", + "type": "library", + "description": "Slim PSR-7 Object Decorators", + "keywords": [ + "psr7", + "psr-7", + "http" + ], + "homepage": "http://slimframework.com", + "license": "MIT", + "authors": [ + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "http://joshlockhart.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Pierre Berube", + "email": "pierre@lgse.com", + "homepage": "http://www.lgse.com" + } + ], + "require": { + "php": "^7.4 || ^8.0", + "ext-SimpleXML": "*", + "ext-fileinfo": "*", + "ext-json": "*", + "ext-libxml": "*", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0" }, - { - "name": "Andrew Smith", - "email": "a.smith@silentworks.co.uk", - "homepage": "http://silentworks.co.uk" + "require-dev": { + "adriansuter/php-autoload-override": "^1.2", + "laminas/laminas-diactoros": "^2.8", + "nyholm/psr7": "^1.5", + "php-http/psr7-integration-tests": "dev-master", + "phpstan/phpstan": "^1.4", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.6" }, - { - "name": "Rob Allen", - "email": "rob@akrabat.com", - "homepage": "http://akrabat.com" + "autoload": { + "psr-4": { + "Slim\\Http\\": "src/" + } }, - { - "name": "Pierre Berube", - "email": "pierre@lgse.com", - "homepage": "http://www.lgse.com" - } - ], - "require": { - "php": "^7.4 || ^8.0", - "ext-SimpleXML": "*", - "ext-fileinfo": "*", - "ext-json": "*", - "ext-libxml": "*", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0" - }, - "require-dev": { - "adriansuter/php-autoload-override": "^1.2", - "laminas/laminas-diactoros": "^2.8", - "nyholm/psr7": "^1.5", - "php-http/psr7-integration-tests": "dev-master", - "phpstan/phpstan": "^1.4", - "phpunit/phpunit": "^9.5", - "squizlabs/php_codesniffer": "^3.6" - }, - "autoload": { - "psr-4": { - "Slim\\Http\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Slim\\Tests\\Http\\": "tests/" + "autoload-dev": { + "psr-4": { + "Slim\\Tests\\Http\\": "tests/" + } + }, + "scripts": { + "test": [ + "@phpunit", + "@phpcs", + "@phpstan" + ], + "phpunit": "phpunit", + "phpcs": "phpcs", + "phpstan": "phpstan --memory-limit=-1" + }, + "config": { + "sort-packages": true } - }, - "scripts": { - "test": [ - "@phpunit", - "@phpcs", - "@phpstan" - ], - "phpunit": "phpunit", - "phpcs": "phpcs", - "phpstan": "phpstan --memory-limit=-1" - }, - "config": { - "sort-packages": true - } } From 66418572626a79373bb5714cf8ef2de39f2b2cc3 Mon Sep 17 00:00:00 2001 From: N'Bayramberdiyev Date: Mon, 4 Apr 2022 23:37:49 +0300 Subject: [PATCH 4/5] skip `testPathWithMultipleSlashes` for laminas-diactoros --- tests/Psr7Integration/Laminas/UriTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/Psr7Integration/Laminas/UriTest.php b/tests/Psr7Integration/Laminas/UriTest.php index bb93f99..9773106 100644 --- a/tests/Psr7Integration/Laminas/UriTest.php +++ b/tests/Psr7Integration/Laminas/UriTest.php @@ -22,6 +22,11 @@ class UriTest extends UriIntegrationTest { + // https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 + protected $skippedTests = [ + 'testPathWithMultipleSlashes' => 'laminas-diactoros does not respect RFC3986.', + ]; + public static function setUpBeforeClass(): void { if (!defined('URI_FACTORY')) { From a3d0c07e89af5e684aa6db47e9b1e1714daf9342 Mon Sep 17 00:00:00 2001 From: N'Bayramberdiyev Date: Tue, 5 Apr 2022 00:23:32 +0300 Subject: [PATCH 5/5] use typed properties --- src/Factory/DecoratedResponseFactory.php | 10 ++-------- src/Factory/DecoratedServerRequestFactory.php | 5 +---- src/Factory/DecoratedUriFactory.php | 5 +---- src/Response.php | 10 ++-------- src/ServerRequest.php | 10 ++-------- src/Uri.php | 5 +---- 6 files changed, 9 insertions(+), 36 deletions(-) diff --git a/src/Factory/DecoratedResponseFactory.php b/src/Factory/DecoratedResponseFactory.php index 1838076..dfed20e 100644 --- a/src/Factory/DecoratedResponseFactory.php +++ b/src/Factory/DecoratedResponseFactory.php @@ -17,15 +17,9 @@ class DecoratedResponseFactory implements ResponseFactoryInterface { - /** - * @var ResponseFactoryInterface - */ - protected $responseFactory; + protected ResponseFactoryInterface $responseFactory; - /** - * @var StreamFactoryInterface - */ - protected $streamFactory; + protected StreamFactoryInterface $streamFactory; /** * @param ResponseFactoryInterface $responseFactory diff --git a/src/Factory/DecoratedServerRequestFactory.php b/src/Factory/DecoratedServerRequestFactory.php index d7e974f..c0f7782 100644 --- a/src/Factory/DecoratedServerRequestFactory.php +++ b/src/Factory/DecoratedServerRequestFactory.php @@ -17,10 +17,7 @@ class DecoratedServerRequestFactory implements ServerRequestFactoryInterface { - /** - * @var ServerRequestFactoryInterface - */ - protected $serverRequestFactory; + protected ServerRequestFactoryInterface $serverRequestFactory; /** * @param ServerRequestFactoryInterface $serverRequestFactory diff --git a/src/Factory/DecoratedUriFactory.php b/src/Factory/DecoratedUriFactory.php index 90f48c3..2c23abd 100644 --- a/src/Factory/DecoratedUriFactory.php +++ b/src/Factory/DecoratedUriFactory.php @@ -16,10 +16,7 @@ class DecoratedUriFactory implements UriFactoryInterface { - /** - * @var UriFactoryInterface - */ - protected $uriFactory; + protected UriFactoryInterface $uriFactory; /** * @param UriFactoryInterface $uriFactory diff --git a/src/Response.php b/src/Response.php index 395a1b1..caa3c27 100644 --- a/src/Response.php +++ b/src/Response.php @@ -36,15 +36,9 @@ class Response implements ResponseInterface { - /** - * @var ResponseInterface - */ - protected $response; + protected ResponseInterface $response; - /** - * @var StreamFactoryInterface - */ - protected $streamFactory; + protected StreamFactoryInterface $streamFactory; /** * EOL characters used for HTTP response. diff --git a/src/ServerRequest.php b/src/ServerRequest.php index d4b6aeb..a3833ee 100644 --- a/src/ServerRequest.php +++ b/src/ServerRequest.php @@ -36,15 +36,9 @@ class ServerRequest implements ServerRequestInterface { - /** - * @var ServerRequestInterface - */ - protected $serverRequest; + protected ServerRequestInterface $serverRequest; - /** - * @var array - */ - protected $bodyParsers; + protected array $bodyParsers; /** * @param ServerRequestInterface $serverRequest diff --git a/src/Uri.php b/src/Uri.php index b53273d..a538975 100644 --- a/src/Uri.php +++ b/src/Uri.php @@ -14,10 +14,7 @@ class Uri implements UriInterface { - /** - * @var UriInterface - */ - protected $uri; + protected UriInterface $uri; /** * @param UriInterface $uri