diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index de0e552..39e4fb8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,12 +4,15 @@ on: [push, pull_request, workflow_dispatch] jobs: phpunit: - name: PHPUnit on PHP v${{ matrix.php }} + name: PHPUnit on PHP v${{ matrix.php }} ${{ matrix.dependencies }} runs-on: ubuntu-latest strategy: - fail-fast: true matrix: php: [ 8.2, 8.3, 8.4 ] + dependencies: ['', --prefer-lowest] + exclude: + - php: 8.4 + dependencies: --prefer-lowest steps: - name: Checkout code @@ -35,7 +38,7 @@ jobs: ${{ runner.os }}-php- - name: Install dependencies - run: composer install --prefer-dist --no-progress + run: composer update --prefer-dist --no-progress ${{ matrix.dependencies }} - name: Execute phpunit run: composer test -- --colors=always diff --git a/composer.json b/composer.json index 541952e..18ae6ad 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "nikic/php-parser": "^5.0", "phpstan/phpdoc-parser": "^2.1", "psr/simple-cache": "^3.0", - "symfony/cache": "^7.0", + "symfony/cache": "^7.3", "symfony/var-exporter": "^7.0", "webmozart/assert": "^1.11" }, diff --git a/src/PHPStan/ReflectorReturnType.php b/src/PHPStan/ReflectorReturnType.php index 9ada9a1..af2133c 100644 --- a/src/PHPStan/ReflectorReturnType.php +++ b/src/PHPStan/ReflectorReturnType.php @@ -87,7 +87,10 @@ private function reflectionTypeClassName(Type $type): ?string private function typeFromMethodCall(MethodCall $methodCall, Scope $scope): ?Type { - $nameArg = $methodCall->getArg('name', 0); + /** @phpstan-ignore function.alreadyNarrowedType */ + $nameArg = method_exists($methodCall, 'getArg') ? + $methodCall->getArg('name', 0) : + $methodCall->getArgs()[0] ?? null; if (!$nameArg) { return null;