Skip to content

Commit

Permalink
chore: fix phpstan (#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer authored Nov 24, 2024
1 parent e3d68b0 commit c2b54c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
php-version: "8.3"
- name: Run Script
run: |
composer global require friendsofphp/php-cs-fixer
Expand All @@ -49,9 +49,9 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
- name: Run Script
run: |
composer install
composer global require phpstan/phpstan
composer global require phpstan/phpstan:~1.10.0
~/.composer/vendor/bin/phpstan analyse
9 changes: 2 additions & 7 deletions src/JWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public static function encode(
?array $head = null
): string {
$header = ['typ' => 'JWT'];
if (isset($head) && \is_array($head)) {
if (isset($head)) {
$header = \array_merge($header, $head);
}
$header['alg'] = $alg;
Expand Down Expand Up @@ -387,12 +387,7 @@ public static function jsonDecode(string $input)
*/
public static function jsonEncode(array $input): string
{
if (PHP_VERSION_ID >= 50400) {
$json = \json_encode($input, \JSON_UNESCAPED_SLASHES);
} else {
// PHP 5.3 only
$json = \json_encode($input);
}
$json = \json_encode($input, \JSON_UNESCAPED_SLASHES);
if ($errno = \json_last_error()) {
self::handleJsonError($errno);
} elseif ($json === 'null') {
Expand Down

0 comments on commit c2b54c2

Please sign in to comment.