Skip to content

Commit c2b54c2

Browse files
authored
chore: fix phpstan (#584)
1 parent e3d68b0 commit c2b54c2

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

.github/workflows/tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Setup PHP
3636
uses: shivammathur/setup-php@v2
3737
with:
38-
php-version: "8.2"
38+
php-version: "8.3"
3939
- name: Run Script
4040
run: |
4141
composer global require friendsofphp/php-cs-fixer
@@ -49,9 +49,9 @@ jobs:
4949
- name: Install PHP
5050
uses: shivammathur/setup-php@v2
5151
with:
52-
php-version: '8.2'
52+
php-version: '8.3'
5353
- name: Run Script
5454
run: |
5555
composer install
56-
composer global require phpstan/phpstan
56+
composer global require phpstan/phpstan:~1.10.0
5757
~/.composer/vendor/bin/phpstan analyse

src/JWT.php

+2-7
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public static function encode(
204204
?array $head = null
205205
): string {
206206
$header = ['typ' => 'JWT'];
207-
if (isset($head) && \is_array($head)) {
207+
if (isset($head)) {
208208
$header = \array_merge($header, $head);
209209
}
210210
$header['alg'] = $alg;
@@ -387,12 +387,7 @@ public static function jsonDecode(string $input)
387387
*/
388388
public static function jsonEncode(array $input): string
389389
{
390-
if (PHP_VERSION_ID >= 50400) {
391-
$json = \json_encode($input, \JSON_UNESCAPED_SLASHES);
392-
} else {
393-
// PHP 5.3 only
394-
$json = \json_encode($input);
395-
}
390+
$json = \json_encode($input, \JSON_UNESCAPED_SLASHES);
396391
if ($errno = \json_last_error()) {
397392
self::handleJsonError($errno);
398393
} elseif ($json === 'null') {

0 commit comments

Comments
 (0)