Skip to content

Commit

Permalink
Allow installing with psr/http-message ^2.0 (#126)
Browse files Browse the repository at this point in the history
* Allow installing with psr/http-message ^2.0
* Update phpstan/phpstan
* Add tests for PHP 8.3
  • Loading branch information
jankonas committed Sep 30, 2024
1 parent e1b0233 commit 8d8703a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
php-versions: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
dependency-versions: ["highest", "lowest"]
runs-on: ${{ matrix.operating-system }}
steps:
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"require": {
"php": "^7.2|^8.0",
"psr/http-message": "^1.0.1",
"psr/http-message": "^1.0.1|^2.0",
"psr/http-server-middleware": "^1.0",
"tuupola/callable-handler": "^0.3.0|^0.4.0|^1.0",
"tuupola/http-factory": "^0.4.0|^1.0.2"
Expand All @@ -32,12 +32,12 @@
},
"require-dev": {
"equip/dispatch": "^2.0",
"laminas/laminas-diactoros": "^1.3|^2.0|^3.0",
"overtrue/phplint": "^3.0|^4.0|^5.0|^6.0",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^8.5.30|^9.0",
"rector/rector": "^0.14.5",
"symplify/easy-coding-standard": "^11.1",
"zendframework/zend-diactoros": "^1.3|^2.0"
"symplify/easy-coding-standard": "^11.1"
},
"config": {
"sort-packages": true
Expand Down
15 changes: 15 additions & 0 deletions src/HttpBasicAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ private function processError(ResponseInterface $response, array $arguments): Re
* Set path where middleware should bind to.
*
* @param string|string[] $path
* @phpstan-ignore method.unused
*/
private function path($path): void
{
Expand All @@ -269,6 +270,7 @@ private function path($path): void
* Set path which middleware ignores.
*
* @param string[] $ignore
* @phpstan-ignore method.unused
*/
private function ignore($ignore): void
{
Expand All @@ -277,6 +279,8 @@ private function ignore($ignore): void

/**
* Set the authenticator.
*
* @phpstan-ignore method.unused
*/
private function authenticator(callable $authenticator): void
{
Expand All @@ -287,6 +291,7 @@ private function authenticator(callable $authenticator): void
* Set the users array.
*
* @param string[] $users
* @phpstan-ignore method.unused
*/
private function users(array $users): void
{
Expand All @@ -295,6 +300,8 @@ private function users(array $users): void

/**
* Set the secure flag.
*
* @phpstan-ignore method.unused
*/
private function secure(bool $secure): void
{
Expand All @@ -305,6 +312,7 @@ private function secure(bool $secure): void
* Set hosts where secure rule is relaxed.
*
* @param string[] $relaxed
* @phpstan-ignore method.unused
*/
private function relaxed(array $relaxed): void
{
Expand All @@ -313,6 +321,8 @@ private function relaxed(array $relaxed): void

/**
* Set the handler which is called before other middlewares.
*
* @phpstan-ignore method.unused
*/
private function before(Closure $before): void
{
Expand All @@ -321,6 +331,8 @@ private function before(Closure $before): void

/**
* Set the handler which is called after other middlewares.
*
* @phpstan-ignore method.unused
*/
private function after(Closure $after): void
{
Expand All @@ -329,6 +341,8 @@ private function after(Closure $after): void

/**
* Set the handler which is if authentication fails.
*
* @phpstan-ignore method.unused
*/
private function error(callable $error): void
{
Expand All @@ -339,6 +353,7 @@ private function error(callable $error): void
* Set the rules
*
* @param RuleInterface[] $rules
* @phpstan-ignore method.unused
*/
private function rules(array $rules): void
{
Expand Down
8 changes: 4 additions & 4 deletions tests/RequestMethodRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@

namespace Tuupola\Middleware\HttpBasicAuthentication;

use Laminas\Diactoros\Response;
use Laminas\Diactoros\ServerRequest;
use Laminas\Diactoros\ServerRequestFactory;
use Laminas\Diactoros\Uri;
use PHPUnit\Framework\TestCase;
use Zend\Diactoros\Response;
use Zend\Diactoros\ServerRequest;
use Zend\Diactoros\ServerRequestFactory;
use Zend\Diactoros\Uri;

class RequestMethodRuleTest extends TestCase
{
Expand Down
8 changes: 4 additions & 4 deletions tests/RequestPathRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@

namespace Tuupola\Middleware\HttpBasicAuthentication;

use Laminas\Diactoros\Response;
use Laminas\Diactoros\ServerRequest;
use Laminas\Diactoros\ServerRequestFactory;
use Laminas\Diactoros\Uri;
use PHPUnit\Framework\TestCase;
use Zend\Diactoros\Response;
use Zend\Diactoros\ServerRequest;
use Zend\Diactoros\ServerRequestFactory;
use Zend\Diactoros\Uri;

class RequestPathTest extends TestCase
{
Expand Down

0 comments on commit 8d8703a

Please sign in to comment.