Skip to content

Commit ca0ce35

Browse files
committed
[ci] add downgrade of nette/utils to use json_decode() for old PHP
1 parent 6535f0e commit ca0ce35

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Diff for: .github/workflows/build.yml

+5
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ jobs:
113113
if: matrix.php-version == '7.1' || matrix.php-version == '7.2' || matrix.php-version == '7.3'
114114
run: "composer require --dev phpunit/phpunit:^7.5.20 --update-with-dependencies"
115115

116+
# in PHP 7.1, the json_decode() 2nd parameter requires bool, while PHP 7.2 it's null|int
117+
- name: "Downgrade nette/utils"
118+
if: matrix.php-version == '7.1'
119+
run: "composer require --dev nette/utils:^2.3 nette/forms:^2.4 --update-with-dependencies"
120+
116121
- name: "Tests"
117122
run: "make tests"
118123

Diff for: src/Type/Nette/JsonDecodeDynamicReturnTypeExtension.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use PhpParser\Node\Arg;
77
use PhpParser\Node\Expr\ClassConstFetch;
88
use PhpParser\Node\Expr\StaticCall;
9+
use PhpParser\Node\Identifier;
910
use PhpParser\Node\Name;
1011
use PHPStan\Analyser\Scope;
1112
use PHPStan\Reflection\MethodReflection;
@@ -91,7 +92,7 @@ private function isForceArray(array $args): bool
9192
$classConstFetch = $secondArg->value;
9293

9394
if ($classConstFetch->class instanceof Name) {
94-
if (! $classConstFetch->name instanceof \PhpParser\Node\Identifier) {
95+
if (! $classConstFetch->name instanceof Identifier) {
9596
return false;
9697
}
9798

0 commit comments

Comments
 (0)