Skip to content

Commit

Permalink
Drop support for PHP version less than 7.4 (#227)
Browse files Browse the repository at this point in the history
* Add typehints to properties
* Add return types to methods
* Drop support for PHP versions below 7.4
  • Loading branch information
JimTools committed Oct 20, 2023
1 parent 5811d7b commit 26ed072
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 72 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.4", "8.0", "8.1", "8.2"]
dependency-versions: ["highest", "lowest"]
runs-on: ${{ matrix.operating-system }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
],
"require": {
"php": "^7.2|^8.0",
"php": "^7.4|^8.0",
"psr/log": "^1.0|^2.0|^3.0",
"firebase/php-jwt": "^3.0|^4.0|^5.0",
"psr/http-message": "^1.0",
Expand Down
13 changes: 3 additions & 10 deletions src/JwtAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
use Psr\Log\LogLevel;
use RuntimeException;
use SplStack;
use Tuupola\Middleware\DoublePassTrait;
use Tuupola\Http\Factory\ResponseFactory;
use Tuupola\Middleware\JwtAuthentication\RequestMethodRule;
use Tuupola\Middleware\JwtAuthentication\RequestPathRule;
Expand All @@ -61,19 +60,13 @@ final class JwtAuthentication implements MiddlewareInterface
* PSR-3 compliant logger.
* @var LoggerInterface|null
*/
private $logger;

/**
* Last error message.
* @var string
*/
private $message;
private ?LoggerInterface $logger = null;

/**
* The rules stack.
* @var SplStack<RuleInterface>
*/
private $rules;
private SplStack $rules;

/**
* Stores all the options passed to the middleware.
Expand All @@ -94,7 +87,7 @@ final class JwtAuthentication implements MiddlewareInterface
* error: null|callable,
* }
*/
private $options = [
private array $options = [
"secure" => true,
"relaxed" => ["localhost", "127.0.0.1"],
"algorithm" => ["HS256", "HS512", "HS384"],
Expand Down
2 changes: 1 addition & 1 deletion src/JwtAuthentication/RequestMethodRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ final class RequestMethodRule implements RuleInterface
* ignore: array<string>,
* }
*/
private $options = [
private array $options = [
"ignore" => ["OPTIONS"]
];

Expand Down
2 changes: 1 addition & 1 deletion src/JwtAuthentication/RequestPathRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ final class RequestPathRule implements RuleInterface
* ignore: array<string>,
* }
*/
private $options = [
private array $options = [
"path" => ["/"],
"ignore" => []
];
Expand Down
2 changes: 1 addition & 1 deletion tests/ArrayAccessImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

class ArrayAccessImpl implements \ArrayAccess
{
private $array = [];
private array $array = [];

public function offsetExists($offset)
{
Expand Down

0 comments on commit 26ed072

Please sign in to comment.