Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,23 @@
}
},
"require": {
"php": ">=7.3",
"ext-swoole": ">=4.5",
"php": ">=8.0",
"ext-json": "*",
"ext-openssl": "*",
"hyperf/cache": "^2.1",
"hyperf/command": "^2.1",
"hyperf/config": "^2.1",
"hyperf/di": "^2.1",
"hyperf/framework": "^2.1",
"hyperf/cache": "~3.0.0",
"hyperf/command": "~3.0.0",
"hyperf/config": "~3.0.0",
"hyperf/di": "~3.0.0",
"hyperf/framework": "~3.0.0",
"lcobucci/jwt": "~4.1.0",
"nesbot/carbon": "^2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"hyperf/testing": "^2.1",
"phpstan/phpstan": "^0.12",
"swoole/ide-helper": "dev-master",
"mockery/mockery": "^1.0"
"hyperf/testing": "~3.0.0",
"mockery/mockery": "^1.0",
"phpstan/phpstan": "^1.9",
"swoole/ide-helper": "dev-master"
},
"config": {
"sort-packages": true
Expand Down
2 changes: 1 addition & 1 deletion src/Claims/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function validate(bool $ignoreExpired = false)
*/
public function hasAllClaims($claims): bool
{
return count($claims) and (new static($claims))->diff($this->keys())->isEmpty();
return count($claims) and (new self($claims))->diff($this->keys())->isEmpty();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/AbstractGenCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class AbstractGenCommand extends HyperfCommand
*/
protected $config;

protected $description;
protected string $description;

public function __construct(ConfigInterface $config)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/GenJwtKeypairCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

class GenJwtKeypairCommand extends AbstractGenCommand
{
protected $name = 'gen:jwt-keypair';
protected ?string $name = 'gen:jwt-keypair';

protected $description = 'Set the JWT private key and public key used to sign the tokens';
protected string $description = 'Set the JWT private key and public key used to sign the tokens';

protected $configs = [
'RS256' => ['private_key_type' => OPENSSL_KEYTYPE_RSA, 'digest_alg' => 'SHA256', 'private_key_bits' => 4096],
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/GenJwtSecretCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

class GenJwtSecretCommand extends AbstractGenCommand
{
protected $name = 'gen:jwt-secret';
protected ?string $name = 'gen:jwt-secret';

protected $description = 'Set the JWT secret key used to sign the tokens';
protected string $description = 'Set the JWT secret key used to sign the tokens';

public function handle()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Jwt.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace HyperfExt\Jwt;

use BadMethodCallException;
use Hyperf\Utils\Context;
use Hyperf\Context\Context;
use HyperfExt\Jwt\Contracts\JwtSubjectInterface;
use HyperfExt\Jwt\Contracts\ManagerInterface;
use HyperfExt\Jwt\Contracts\RequestParser\RequestParserInterface;
Expand Down
12 changes: 6 additions & 6 deletions src/Payload.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use Countable;
use Hyperf\Utils\ApplicationContext;
use Hyperf\Utils\Arr;
use Hyperf\Utils\Contracts\Arrayable;
use Hyperf\Utils\Contracts\Jsonable;
use Hyperf\Contract\Arrayable;
use Hyperf\Contract\Jsonable;
use HyperfExt\Jwt\Claims\AbstractClaim;
use HyperfExt\Jwt\Claims\Collection;
use HyperfExt\Jwt\Contracts\PayloadValidatorInterface;
Expand Down Expand Up @@ -196,7 +196,7 @@ public function toJson(int $options = JSON_UNESCAPED_SLASHES): string
*
* @param mixed $key
*/
public function offsetExists($key): bool
public function offsetExists(mixed $key): bool
{
return Arr::has($this->toArray(), $key);
}
Expand All @@ -208,7 +208,7 @@ public function offsetExists($key): bool
*
* @return mixed
*/
public function offsetGet($key)
public function offsetGet(mixed $key): mixed
{
return Arr::get($this->toArray(), $key);
}
Expand All @@ -221,7 +221,7 @@ public function offsetGet($key)
*
* @throws \HyperfExt\Jwt\Exceptions\PayloadException
*/
public function offsetSet($key, $value)
public function offsetSet(mixed $key, mixed $value): void
{
throw new PayloadException('The payload is immutable');
}
Expand All @@ -233,7 +233,7 @@ public function offsetSet($key, $value)
*
* @throws \HyperfExt\Jwt\Exceptions\PayloadException
*/
public function offsetUnset($key)
public function offsetUnset(mixed $key): void
{
throw new PayloadException('The payload is immutable');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/RequestParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Hyperf\HttpMessage\Server\Request;
use Hyperf\HttpServer\Request as HttpServerRequest;
use Hyperf\HttpServer\Router\Dispatched;
use Hyperf\Utils\Context;
use Hyperf\Context\Context;
use HyperfExt\Jwt\RequestParser\Handlers\AuthHeaders;
use HyperfExt\Jwt\RequestParser\Handlers\Cookies;
use HyperfExt\Jwt\RequestParser\Handlers\InputSource;
Expand Down
5 changes: 1 addition & 4 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
*/
use Hyperf\Config\Config;
use Hyperf\Contract\ConfigInterface;
use Hyperf\Di\Annotation\AnnotationReader;
use Hyperf\Di\ClassLoader;
use Hyperf\Di\Container;
use Hyperf\Di\Definition\DefinitionSourceFactory;
use Hyperf\HttpMessage\Server\Request;
use Hyperf\HttpServer\Request as HttpServerRequest;
use Hyperf\Utils\ApplicationContext;
use Hyperf\Utils\Context;
use Hyperf\Context\Context;
use HyperfExt\Jwt\Contracts\PayloadValidatorInterface;
use HyperfExt\Jwt\Contracts\TokenValidatorInterface;
use HyperfExt\Jwt\Validators\PayloadValidator;
Expand All @@ -31,8 +30,6 @@

require_once dirname(dirname(__FILE__)) . '/vendor/autoload.php';

AnnotationReader::addGlobalIgnoredName('mixin');

ClassLoader::init();

$container = new Container((new DefinitionSourceFactory(true))());
Expand Down