Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Rules/Symfony/ContainerInterfacePrivateServiceRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Analyser\DependencyEmitter;
use PHPStan\Analyser\DependencyTracker;
use PHPStan\Analyser\Scope;
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleErrorBuilder;
Expand Down Expand Up @@ -34,7 +34,7 @@ public function getNodeType(): string
}

/**
* @param Scope&DependencyEmitter $scope
* @param Scope&DependencyTracker $scope
*/
public function processNode(Node $node, Scope $scope): array
{
Expand Down Expand Up @@ -71,7 +71,7 @@ public function processNode(Node $node, Scope $scope): array

$serviceId = $this->serviceMap::getServiceIdFromNode($node->getArgs()[0]->value, $scope);
if ($serviceId !== null) {
$scope->valueDependency(ServiceResultCacheValueExtension::class, $serviceId);
$scope->trackValueDependency(ServiceResultCacheValueExtension::class, $serviceId);
$service = $this->serviceMap->getService($serviceId);
if ($service !== null && !$service->isPublic()) {
return [
Expand Down
6 changes: 3 additions & 3 deletions src/Rules/Symfony/ContainerInterfaceUnknownServiceRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Analyser\DependencyEmitter;
use PHPStan\Analyser\DependencyTracker;
use PHPStan\Analyser\Scope;
use PHPStan\Node\Printer\Printer;
use PHPStan\Rules\Rule;
Expand Down Expand Up @@ -37,7 +37,7 @@ public function getNodeType(): string
}

/**
* @param Scope&DependencyEmitter $scope
* @param Scope&DependencyTracker $scope
*/
public function processNode(Node $node, Scope $scope): array
{
Expand Down Expand Up @@ -70,7 +70,7 @@ public function processNode(Node $node, Scope $scope): array

$serviceId = $this->serviceMap::getServiceIdFromNode($node->getArgs()[0]->value, $scope);
if ($serviceId !== null) {
$scope->valueDependency(ServiceResultCacheValueExtension::class, $serviceId);
$scope->trackValueDependency(ServiceResultCacheValueExtension::class, $serviceId);
$service = $this->serviceMap->getService($serviceId);
$serviceIdType = $scope->getType($node->getArgs()[0]->value);
if ($service === null && !$scope->getType(Helper::createMarkerNode($node->var, $serviceIdType, $this->printer))->equals($serviceIdType)) {
Expand Down
6 changes: 3 additions & 3 deletions src/Type/Symfony/MessengerHandleTraitReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Identifier;
use PHPStan\Analyser\DependencyEmitter;
use PHPStan\Analyser\DependencyTracker;
use PHPStan\Analyser\Scope;
use PHPStan\Symfony\MessageMap;
use PHPStan\Symfony\MessageMapFactory;
Expand All @@ -32,7 +32,7 @@ public function __construct(MessageMapFactory $symfonyMessageMapFactory)
}

/**
* @param Scope&DependencyEmitter $scope
* @param Scope&DependencyTracker $scope
*/
public function getType(Expr $expr, Scope $scope): ?Type
{
Expand All @@ -56,7 +56,7 @@ public function getType(Expr $expr, Scope $scope): ?Type

$returnTypes = [];
foreach ($argClassNames as $argClassName) {
$scope->valueDependency(MessageResultCacheValueExtension::class, $argClassName);
$scope->trackValueDependency(MessageResultCacheValueExtension::class, $argClassName);
$returnType = $messageMap->getTypeForClass($argClassName);

if (is_null($returnType)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Identifier;
use PHPStan\Analyser\DependencyEmitter;
use PHPStan\Analyser\DependencyTracker;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Symfony\MessageMap;
Expand Down Expand Up @@ -49,7 +49,7 @@ public function __construct(MessageMapFactory $messageMapFactory, ?array $messen
}

/**
* @param Scope&DependencyEmitter $scope
* @param Scope&DependencyTracker $scope
*/
public function getType(Expr $expr, Scope $scope): ?Type
{
Expand All @@ -72,7 +72,7 @@ public function getType(Expr $expr, Scope $scope): ?Type
$returnTypes = [];
foreach ($argClassNames as $argClassName) {
$messageMap = $this->getMessageMap();
$scope->valueDependency(MessageResultCacheValueExtension::class, $argClassName);
$scope->trackValueDependency(MessageResultCacheValueExtension::class, $argClassName);
$returnType = $messageMap->getTypeForClass($argClassName);

if (is_null($returnType)) {
Expand Down
12 changes: 6 additions & 6 deletions src/Type/Symfony/ParameterDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace PHPStan\Type\Symfony;

use PhpParser\Node\Expr\MethodCall;
use PHPStan\Analyser\DependencyEmitter;
use PHPStan\Analyser\DependencyTracker;
use PHPStan\Analyser\Scope;
use PHPStan\PhpDoc\TypeStringResolver;
use PHPStan\Reflection\MethodReflection;
Expand Down Expand Up @@ -89,7 +89,7 @@ public function isMethodSupported(MethodReflection $methodReflection): bool
}

/**
* @param Scope&DependencyEmitter $scope
* @param Scope&DependencyTracker $scope
*/
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): ?Type
{
Expand All @@ -103,7 +103,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
}

/**
* @param Scope&DependencyEmitter $scope
* @param Scope&DependencyTracker $scope
*/
private function getGetTypeFromMethodCall(
MethodCall $methodCall,
Expand Down Expand Up @@ -131,7 +131,7 @@ private function getGetTypeFromMethodCall(

$returnTypes = [];
foreach ($parameterKeys as $parameterKey) {
$scope->valueDependency(ParameterResultCacheValueExtension::class, $parameterKey);
$scope->trackValueDependency(ParameterResultCacheValueExtension::class, $parameterKey);
$parameter = $this->parameterMap->getParameter($parameterKey);
if ($parameter === null) {
return $defaultReturnType;
Expand Down Expand Up @@ -212,7 +212,7 @@ private function generalizeType(Type $type): Type
}

/**
* @param Scope&DependencyEmitter $scope
* @param Scope&DependencyTracker $scope
*/
private function getHasTypeFromMethodCall(
MethodCall $methodCall,
Expand All @@ -230,7 +230,7 @@ private function getHasTypeFromMethodCall(

$has = null;
foreach ($parameterKeys as $parameterKey) {
$scope->valueDependency(ParameterResultCacheValueExtension::class, $parameterKey);
$scope->trackValueDependency(ParameterResultCacheValueExtension::class, $parameterKey);
$parameter = $this->parameterMap->getParameter($parameterKey);

if ($has === null) {
Expand Down
12 changes: 6 additions & 6 deletions src/Type/Symfony/ServiceDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace PHPStan\Type\Symfony;

use PhpParser\Node\Expr\MethodCall;
use PHPStan\Analyser\DependencyEmitter;
use PHPStan\Analyser\DependencyTracker;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\MethodReflection;
use PHPStan\ShouldNotHappenException;
Expand Down Expand Up @@ -61,7 +61,7 @@ public function isMethodSupported(MethodReflection $methodReflection): bool
}

/**
* @param Scope&DependencyEmitter $scope
* @param Scope&DependencyTracker $scope
*/
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): ?Type
{
Expand All @@ -75,7 +75,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
}

/**
* @param Scope&DependencyEmitter $scope
* @param Scope&DependencyTracker $scope
*/
private function getGetTypeFromMethodCall(
MethodCall $methodCall,
Expand All @@ -93,7 +93,7 @@ private function getGetTypeFromMethodCall(

$serviceId = $this->serviceMap::getServiceIdFromNode($methodCall->getArgs()[0]->value, $scope);
if ($serviceId !== null) {
$scope->valueDependency(ServiceResultCacheValueExtension::class, $serviceId);
$scope->trackValueDependency(ServiceResultCacheValueExtension::class, $serviceId);
$service = $this->serviceMap->getService($serviceId);
if ($service !== null && (!$service->isSynthetic() || $service->getClass() !== null)) {
return new ObjectType($this->determineServiceClass($parameterBag, $service) ?? $serviceId);
Expand Down Expand Up @@ -128,7 +128,7 @@ private function tryCreateParameterBag(): ?ParameterBag
}

/**
* @param Scope&DependencyEmitter $scope
* @param Scope&DependencyTracker $scope
*/
private function getHasTypeFromMethodCall(
MethodCall $methodCall,
Expand All @@ -141,7 +141,7 @@ private function getHasTypeFromMethodCall(

$serviceId = $this->serviceMap::getServiceIdFromNode($methodCall->getArgs()[0]->value, $scope);
if ($serviceId !== null) {
$scope->valueDependency(ServiceResultCacheValueExtension::class, $serviceId);
$scope->trackValueDependency(ServiceResultCacheValueExtension::class, $serviceId);
$service = $this->serviceMap->getService($serviceId);
return new ConstantBooleanType($service !== null && $service->isPublic());
}
Expand Down
Loading