Skip to content

Commit ea48592

Browse files
committed
Call ScopeFactory with just one argument
1 parent 99f2344 commit ea48592

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

phpstan-baseline.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ parameters:
2525
count: 1
2626
path: src/Rules/Doctrine/ORM/EntityRelationRule.php
2727

28+
-
29+
message: "#^Calling PHPStan\\\\Analyser\\\\MutatingScope\\:\\:enterNamespace\\(\\) is not covered by backward compatibility promise\\. The method might change in a minor PHPStan version\\.$#"
30+
count: 1
31+
path: src/Type/Doctrine/QueryBuilder/OtherMethodQueryBuilderParser.php
32+
2833
-
2934
message: "#^Call to method getProperty\\(\\) on an unknown class PHPStan\\\\BetterReflection\\\\Reflection\\\\Adapter\\\\ReflectionEnum\\.$#"
3035
count: 1

src/Type/Doctrine/QueryBuilder/OtherMethodQueryBuilderParser.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ private function findQueryBuilderTypesInCalledMethod(Scope $scope, MethodCall $m
103103
/** @var ScopeFactory $scopeFactory */
104104
$scopeFactory = $this->container->getByType(ScopeFactory::class);
105105

106-
$methodScope = $scopeFactory->create(
107-
ScopeContext::create($fileName),
108-
$scope->isDeclareStrictTypes(),
109-
[],
110-
$methodReflection,
111-
$scope->getNamespace()
112-
)->enterClass($methodReflection->getDeclaringClass())->enterClassMethod($methodNode, TemplateTypeMap::createEmpty(), [], null, null, null, false, false, false);
106+
$methodScope = $scopeFactory->create(ScopeContext::create($fileName));
107+
if ($scope->getNamespace() !== null) {
108+
$methodScope = $methodScope->enterNamespace($scope->getNamespace());
109+
}
110+
111+
$methodScope = $methodScope->enterClass($methodReflection->getDeclaringClass())
112+
->enterClassMethod($methodNode, TemplateTypeMap::createEmpty(), [], null, null, null, false, false, false);
113113

114114
$queryBuilderTypes = [];
115115

0 commit comments

Comments
 (0)