diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index d02b22b..fd6cd79 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: true matrix: - php-versions: ['8.1', '8.2'] + php-versions: ['8.1', '8.2', '8.3'] steps: - uses: actions/checkout@v2 - name: Install PHP diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index cbd174e..7ee02f5 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -4,9 +4,13 @@ $rules = [ '@Symfony' => true, - 'new_with_braces' => true, - 'concat_space' => ['spacing' => 'one'], - 'array_syntax' => ['syntax' => 'short'], + 'new_with_parentheses' => true, + 'concat_space' => [ + 'spacing' => 'one', + ], + 'array_syntax' => [ + 'syntax' => 'short', + ], 'yoda_style' => false, 'phpdoc_no_empty_return' => false, 'no_superfluous_phpdoc_tags' => true, @@ -16,11 +20,20 @@ 'void_return' => true, 'non_printable_character' => true, 'modernize_types_casting' => true, - 'ordered_interfaces' => ['order' => 'alpha', 'direction' => 'ascend'], + 'ordered_interfaces' => [ + 'order' => 'alpha', + 'direction' => 'ascend', + ], 'date_time_immutable' => true, 'native_constant_invocation' => true, 'combine_nested_dirname' => true, - 'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true], + 'native_function_invocation' => [ + 'include' => [ + '@compiler_optimized', + ], + 'scope' => 'namespaced', + 'strict' => true, + ], 'php_unit_construct' => true, 'php_unit_dedicate_assert' => true, 'php_unit_expectation' => true, diff --git a/LICENSE b/LICENSE index a8f4eeb..8b50177 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 liquetsoft +Copyright (c) 2019 marvin255 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index 347d5ca..f5ee37f 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -25,7 +25,7 @@ RUN docker-php-ext-install zip opcache \ && echo 'xdebug.mode=coverage' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.5.8 \ +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.7.6 \ && mkdir -p /.composer && chmod -Rf 777 /.composer diff --git a/psalm.xml b/psalm.xml index 061f082..b145732 100644 --- a/psalm.xml +++ b/psalm.xml @@ -16,6 +16,7 @@ + diff --git a/src/JwtSecretFactory.php b/src/JwtSecretFactory.php index d94892c..470c1ad 100644 --- a/src/JwtSecretFactory.php +++ b/src/JwtSecretFactory.php @@ -19,7 +19,7 @@ private function __construct() /** * Creates object that contains key secret. */ - public static function create(string $secret, string $passPhrase = null): Secret + public static function create(string $secret, ?string $passPhrase = null): Secret { return new SecretBase($secret, $passPhrase); } diff --git a/src/JwtSignerFactory.php b/src/JwtSignerFactory.php index 42e51ee..a1fa0c7 100644 --- a/src/JwtSignerFactory.php +++ b/src/JwtSignerFactory.php @@ -23,7 +23,7 @@ private function __construct() /** * Creates RSA signer. */ - public static function createRsa(Algorithm $algorithm, Secret $public = null, Secret $private = null): JwtSigner + public static function createRsa(Algorithm $algorithm, ?Secret $public = null, ?Secret $private = null): JwtSigner { $implementation = $algorithm->getImplementation(); if (!is_subclass_of($implementation, Rsa::class)) { diff --git a/src/JwtValidator.php b/src/JwtValidator.php index 612be30..334ee70 100644 --- a/src/JwtValidator.php +++ b/src/JwtValidator.php @@ -17,5 +17,5 @@ interface JwtValidator * * @param Constraint|Constraint[]|null $constraints */ - public function validate(Jwt $token, Constraint|array $constraints = null): ValidationResult; + public function validate(Jwt $token, Constraint|array|null $constraints = null): ValidationResult; } diff --git a/src/Signer/SecretBase.php b/src/Signer/SecretBase.php index c40718e..1608f1a 100644 --- a/src/Signer/SecretBase.php +++ b/src/Signer/SecretBase.php @@ -38,7 +38,7 @@ public function getSecret(): string } $secret = file_get_contents($filePath); - if (empty($secret)) { + if ($secret === '') { throw new SecretFileNotFoundException(sprintf('Secret file %s is empty', $this->secret)); } diff --git a/src/Validator/Validator.php b/src/Validator/Validator.php index f335a81..7507fa9 100644 --- a/src/Validator/Validator.php +++ b/src/Validator/Validator.php @@ -33,7 +33,7 @@ public function __construct(iterable $defaultConstraints = []) /** * {@inheritDoc} */ - public function validate(Jwt $token, Constraint|array $constraints = null): ValidationResult + public function validate(Jwt $token, Constraint|array|null $constraints = null): ValidationResult { $constraintsForValidation = $this->defineConstraintsList($constraints);