From 7a94de8f6e48cb334fd1af2107307de7321a1a58 Mon Sep 17 00:00:00 2001 From: Sander Muller Date: Wed, 26 Aug 2026 10:12:37 +0200 Subject: [PATCH] Ask the node-callback scope directly instead of toMutatingScope() phpstan-src deprecated Scope::toMutatingScope() - the callback scope now answers every ask itself - so this call fails phpstan-doctrine's own `make phpstan` on the extension-tests lane of every phpstan-src pull request. Calling getType() on the scope is what the deprecation message recommends. It answers from the walk's stored results from 2.2.10 onwards, so the constraint moves with it. Co-Authored-By: Claude Opus 5 (1M context) --- composer.json | 2 +- .../Doctrine/QueryBuilder/OtherMethodQueryBuilderParser.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 7c525967..2d874dee 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "keywords": ["static analysis"], "require": { "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.2.2" + "phpstan/phpstan": "^2.2.10" }, "conflict": { "doctrine/collections": "<1.0", diff --git a/src/Type/Doctrine/QueryBuilder/OtherMethodQueryBuilderParser.php b/src/Type/Doctrine/QueryBuilder/OtherMethodQueryBuilderParser.php index f14913d2..153291f5 100644 --- a/src/Type/Doctrine/QueryBuilder/OtherMethodQueryBuilderParser.php +++ b/src/Type/Doctrine/QueryBuilder/OtherMethodQueryBuilderParser.php @@ -98,7 +98,7 @@ public function findQueryBuilderTypesInCalledMethod(Scope $scope, MethodReflecti return; } - $exprType = $scope->toMutatingScope()->getType($node->expr); + $exprType = $scope->getType($node->expr); TypeTraverser::map($exprType, static function (Type $type, callable $traverse) use (&$queryBuilderTypes): Type { if ($type instanceof UnionType || $type instanceof IntersectionType) {