Skip to content

Commit 7965f97

Browse files
committed
Revert "Fix multi processing of expr in Pre/Post Inc/Dec"
This reverts commit 159eca6.
1 parent 159eca6 commit 7965f97

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3900,25 +3900,27 @@ static function (): void {
39003900
|| $expr instanceof Expr\PreDec
39013901
|| $expr instanceof Expr\PostDec
39023902
) {
3903+
$result = $this->processExprNode($stmt, $expr->var, $scope, $nodeCallback, $context->enterDeep());
3904+
$scope = $result->getScope();
3905+
$hasYield = $result->hasYield();
3906+
$throwPoints = $result->getThrowPoints();
3907+
$impurePoints = $result->getImpurePoints();
3908+
$isAlwaysTerminating = $result->isAlwaysTerminating();
3909+
39033910
$newExpr = $expr;
39043911
if ($expr instanceof Expr\PostInc) {
39053912
$newExpr = new Expr\PreInc($expr->var);
39063913
} elseif ($expr instanceof Expr\PostDec) {
39073914
$newExpr = new Expr\PreDec($expr->var);
39083915
}
39093916

3910-
$result = $this->processVirtualAssign(
3917+
$scope = $this->processVirtualAssign(
39113918
$scope,
39123919
$stmt,
39133920
$expr->var,
39143921
$newExpr,
39153922
$nodeCallback,
3916-
);
3917-
$scope = $result->getScope();
3918-
$hasYield = $result->hasYield();
3919-
$throwPoints = $result->getThrowPoints();
3920-
$impurePoints = $result->getImpurePoints();
3921-
$isAlwaysTerminating = $result->isAlwaysTerminating();
3923+
)->getScope();
39223924
} elseif ($expr instanceof Ternary) {
39233925
$ternaryCondResult = $this->processExprNode($stmt, $expr->cond, $scope, $nodeCallback, $context->enterDeep());
39243926
$throwPoints = $ternaryCondResult->getThrowPoints();

tests/PHPStan/Rules/Pure/PureMethodRuleTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ public function testPureConstructor(): void
157157
{
158158
$this->treatPhpDocTypesAsCertain = true;
159159
$this->analyse([__DIR__ . '/data/pure-constructor.php'], [
160+
[
161+
'Impure static property access in pure method PureConstructor\Foo::__construct().',
162+
19,
163+
],
160164
[
161165
'Impure property assignment in pure method PureConstructor\Foo::__construct().',
162166
19,

0 commit comments

Comments
 (0)