Skip to content

Commit 93201eb

Browse files
committed
[BCB] Remove ConstantReflection::getValue()
1 parent 93b3bf5 commit 93201eb

File tree

4 files changed

+1
-31
lines changed

4 files changed

+1
-31
lines changed

UPGRADING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,4 @@ Instead of `PHPStanTestCase::createBroker()`, call `PHPStanTestCase::createRefle
241241
* Remove `PHPStanTestCase::getReflectors()`, use `getReflector()` instead
242242
* Remove `ClassReflection::getFileNameWithPhpDocs()`, use `getFileName()` instead
243243
* Remove `AnalysisResult::getInternalErrors()`, use `getInternalErrorObjects()` instead
244+
* Remove `ConstantReflection::getValue()`, use `getValueExpr()` instead. To get `Type` from `Expr`, use `Scope::getType()` or `InitializerExprTypeResolver::getType()`

src/Reflection/ClassConstantReflection.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
namespace PHPStan\Reflection;
44

55
use PhpParser\Node\Expr;
6-
use PHPStan\BetterReflection\NodeCompiler\Exception\UnableToCompileNode;
76
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionClassConstant;
87
use PHPStan\TrinaryLogic;
98
use PHPStan\Type\Type;
109
use PHPStan\Type\TypehintHelper;
11-
use const NAN;
1210

1311
/**
1412
* @api
@@ -41,19 +39,6 @@ public function getFileName(): ?string
4139
return $this->declaringClass->getFileName();
4240
}
4341

44-
/**
45-
* @deprecated Use getValueExpr()
46-
* @return mixed
47-
*/
48-
public function getValue()
49-
{
50-
try {
51-
return $this->reflection->getValue();
52-
} catch (UnableToCompileNode) {
53-
return NAN;
54-
}
55-
}
56-
5742
public function getValueExpr(): Expr
5843
{
5944
return $this->reflection->getValueExpression();

src/Reflection/ConstantReflection.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
interface ConstantReflection extends ClassMemberReflection, GlobalConstantReflection
99
{
1010

11-
/**
12-
* @deprecated Use getValueExpr()
13-
* @return mixed
14-
*/
15-
public function getValue();
16-
1711
public function getValueExpr(): Expr;
1812

1913
}

src/Reflection/Dummy/DummyConstantReflection.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,6 @@ public function getName(): string
5151
return $this->name;
5252
}
5353

54-
/**
55-
* @deprecated
56-
* @return mixed
57-
*/
58-
public function getValue()
59-
{
60-
// so that Scope::getTypeFromValue() returns mixed
61-
return new stdClass();
62-
}
63-
6454
public function getValueType(): Type
6555
{
6656
return new MixedType();

0 commit comments

Comments
 (0)