Skip to content

Commit

Permalink
Run new linters (#15)
Browse files Browse the repository at this point in the history
* Run new linters

* Add php 8.3

* Suppress MixedAssignment
  • Loading branch information
marvin255 authored Jun 8, 2024
1 parent c9379fa commit 8abf8e0
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 18 additions & 5 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<issueHandlers>
<MixedAssignment errorLevel="suppress"/>
<MissingClassConstType errorLevel="suppress"/>
<PropertyNotSetInConstructor>
<errorLevel type="suppress">
<directory name="./tests"/>
Expand Down
2 changes: 1 addition & 1 deletion src/JwtSecretFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/JwtSignerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion src/JwtValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion src/Signer/SecretBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Validator/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 8abf8e0

Please sign in to comment.