Skip to content

Commit

Permalink
Deprecated PHPStan\Broker\Broker. Use PHPStan\Reflection\ReflectionPr…
Browse files Browse the repository at this point in the history
…ovider instead.
  • Loading branch information
ondrejmirtes committed Sep 23, 2021
1 parent 1e5cf58 commit c775594
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
36 changes: 36 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ parameters:
count: 1
path: src/Testing/PHPStanTestCase.php

-
message:
"""
#^Call to deprecated method getUniversalObjectCratesClasses\\(\\) of class PHPStan\\\\Broker\\\\Broker\\:
Inject %%universalObjectCratesClasses%% parameter instead\\.$#
"""
count: 1
path: src/Type/ObjectType.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
Expand Down Expand Up @@ -280,6 +289,33 @@ parameters:
count: 1
path: tests/PHPStan/Analyser/EvaluationOrderTest.php

-
message:
"""
#^Call to deprecated method getClass\\(\\) of class PHPStan\\\\Broker\\\\Broker\\:
Use PHPStan\\\\Reflection\\\\ReflectionProvider instead$#
"""
count: 1
path: tests/PHPStan/Broker/BrokerTest.php

-
message:
"""
#^Call to deprecated method getFunction\\(\\) of class PHPStan\\\\Broker\\\\Broker\\:
Use PHPStan\\\\Reflection\\\\ReflectionProvider instead$#
"""
count: 1
path: tests/PHPStan/Broker/BrokerTest.php

-
message:
"""
#^Call to deprecated method hasClass\\(\\) of class PHPStan\\\\Broker\\\\Broker\\:
Use PHPStan\\\\Reflection\\\\ReflectionProvider instead$#
"""
count: 1
path: tests/PHPStan/Broker/BrokerTest.php

-
message: "#^Constant SOME_CONSTANT_IN_AUTOLOAD_FILE not found\\.$#"
count: 1
Expand Down
35 changes: 35 additions & 0 deletions src/Broker/Broker.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,62 +45,97 @@ public static function getInstance(): Broker
return self::$instance;
}

/**
* @deprecated Use PHPStan\Reflection\ReflectionProvider instead
*/
public function hasClass(string $className): bool
{
return $this->reflectionProvider->hasClass($className);
}

/**
* @deprecated Use PHPStan\Reflection\ReflectionProvider instead
*/
public function getClass(string $className): ClassReflection
{
return $this->reflectionProvider->getClass($className);
}

/**
* @deprecated Use PHPStan\Reflection\ReflectionProvider instead
*/
public function getClassName(string $className): string
{
return $this->reflectionProvider->getClassName($className);
}

/**
* @deprecated Use PHPStan\Reflection\ReflectionProvider instead
*/
public function supportsAnonymousClasses(): bool
{
return $this->reflectionProvider->supportsAnonymousClasses();
}

/**
* @deprecated Use PHPStan\Reflection\ReflectionProvider instead
*/
public function getAnonymousClassReflection(\PhpParser\Node\Stmt\Class_ $classNode, Scope $scope): ClassReflection
{
return $this->reflectionProvider->getAnonymousClassReflection($classNode, $scope);
}

/**
* @deprecated Use PHPStan\Reflection\ReflectionProvider instead
*/
public function hasFunction(\PhpParser\Node\Name $nameNode, ?Scope $scope): bool
{
return $this->reflectionProvider->hasFunction($nameNode, $scope);
}

/**
* @deprecated Use PHPStan\Reflection\ReflectionProvider instead
*/
public function getFunction(\PhpParser\Node\Name $nameNode, ?Scope $scope): FunctionReflection
{
return $this->reflectionProvider->getFunction($nameNode, $scope);
}

/**
* @deprecated Use PHPStan\Reflection\ReflectionProvider instead
*/
public function resolveFunctionName(\PhpParser\Node\Name $nameNode, ?Scope $scope): ?string
{
return $this->reflectionProvider->resolveFunctionName($nameNode, $scope);
}

/**
* @deprecated Use PHPStan\Reflection\ReflectionProvider instead
*/
public function hasConstant(\PhpParser\Node\Name $nameNode, ?Scope $scope): bool
{
return $this->reflectionProvider->hasConstant($nameNode, $scope);
}

/**
* @deprecated Use PHPStan\Reflection\ReflectionProvider instead
*/
public function getConstant(\PhpParser\Node\Name $nameNode, ?Scope $scope): GlobalConstantReflection
{
return $this->reflectionProvider->getConstant($nameNode, $scope);
}

/**
* @deprecated Use PHPStan\Reflection\ReflectionProvider instead
*/
public function resolveConstantName(\PhpParser\Node\Name $nameNode, ?Scope $scope): ?string
{
return $this->reflectionProvider->resolveConstantName($nameNode, $scope);
}

/**
* @deprecated Inject %universalObjectCratesClasses% parameter instead.
*
* @return string[]
*/
public function getUniversalObjectCratesClasses(): array
Expand Down

0 comments on commit c775594

Please sign in to comment.