Skip to content

Commit bee17d3

Browse files
committed
Some handlers only need to reference truthy/falsey scope of the processed expression
1 parent be0124d commit bee17d3

21 files changed

Lines changed: 2 additions & 42 deletions

src/Analyser/ExprHandler/ArrayHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
7575
isAlwaysTerminating: $isAlwaysTerminating,
7676
throwPoints: $throwPoints,
7777
impurePoints: $impurePoints,
78-
truthyScopeCallback: static fn (): MutatingScope => $scope->filterByTruthyValue($expr),
79-
falseyScopeCallback: static fn (): MutatingScope => $scope->filterByFalseyValue($expr),
8078
);
8179
}
8280

src/Analyser/ExprHandler/BitwiseNotHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
4444
isAlwaysTerminating: $result->isAlwaysTerminating(),
4545
throwPoints: $result->getThrowPoints(),
4646
impurePoints: $result->getImpurePoints(),
47-
truthyScopeCallback: static fn (): MutatingScope => $scope->filterByTruthyValue($expr),
48-
falseyScopeCallback: static fn (): MutatingScope => $scope->filterByFalseyValue($expr),
4947
);
5048
}
5149

src/Analyser/ExprHandler/CloneHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
4141
isAlwaysTerminating: $result->isAlwaysTerminating(),
4242
throwPoints: $result->getThrowPoints(),
4343
impurePoints: $result->getImpurePoints(),
44-
truthyScopeCallback: static fn (): MutatingScope => $scope->filterByTruthyValue($expr),
45-
falseyScopeCallback: static fn (): MutatingScope => $scope->filterByFalseyValue($expr),
4644
);
4745
}
4846

src/Analyser/ExprHandler/ErrorSuppressHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
3737
isAlwaysTerminating: $result->isAlwaysTerminating(),
3838
throwPoints: $result->getThrowPoints(),
3939
impurePoints: $result->getImpurePoints(),
40-
truthyScopeCallback: static fn (): MutatingScope => $scope->filterByTruthyValue($expr),
41-
falseyScopeCallback: static fn (): MutatingScope => $scope->filterByFalseyValue($expr),
40+
truthyScopeCallback: static fn (): MutatingScope => $result->getTruthyScope(),
41+
falseyScopeCallback: static fn (): MutatingScope => $result->getFalseyScope(),
4242
);
4343
}
4444

src/Analyser/ExprHandler/EvalHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
4646
isAlwaysTerminating: $result->isAlwaysTerminating(),
4747
throwPoints: array_merge($result->getThrowPoints(), [InternalThrowPoint::createImplicit($scope, $expr)]),
4848
impurePoints: array_merge($result->getImpurePoints(), [new ImpurePoint($scope, $expr, 'eval', 'eval', true)]),
49-
truthyScopeCallback: static fn (): MutatingScope => $scope->filterByTruthyValue($expr),
50-
falseyScopeCallback: static fn (): MutatingScope => $scope->filterByFalseyValue($expr),
5149
);
5250
}
5351

src/Analyser/ExprHandler/ExitHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
5353
isAlwaysTerminating: true,
5454
throwPoints: $throwPoints,
5555
impurePoints: $impurePoints,
56-
truthyScopeCallback: static fn (): MutatingScope => $scope->filterByTruthyValue($expr),
57-
falseyScopeCallback: static fn (): MutatingScope => $scope->filterByFalseyValue($expr),
5856
);
5957
}
6058

src/Analyser/ExprHandler/IncludeHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
4848
isAlwaysTerminating: $result->isAlwaysTerminating(),
4949
throwPoints: array_merge($result->getThrowPoints(), [InternalThrowPoint::createImplicit($scope, $expr)]),
5050
impurePoints: array_merge($result->getImpurePoints(), [new ImpurePoint($scope, $expr, $identifier, $identifier, true)]),
51-
truthyScopeCallback: static fn (): MutatingScope => $scope->filterByTruthyValue($expr),
52-
falseyScopeCallback: static fn (): MutatingScope => $scope->filterByFalseyValue($expr),
5351
);
5452
}
5553

src/Analyser/ExprHandler/InterpolatedStringHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
6060
isAlwaysTerminating: $isAlwaysTerminating,
6161
throwPoints: $throwPoints,
6262
impurePoints: $impurePoints,
63-
truthyScopeCallback: static fn (): MutatingScope => $scope->filterByTruthyValue($expr),
64-
falseyScopeCallback: static fn (): MutatingScope => $scope->filterByFalseyValue($expr),
6563
);
6664
}
6765

src/Analyser/ExprHandler/NewHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
230230
isAlwaysTerminating: $isAlwaysTerminating,
231231
throwPoints: $throwPoints,
232232
impurePoints: $impurePoints,
233-
truthyScopeCallback: static fn (): MutatingScope => $scope->filterByTruthyValue($expr),
234-
falseyScopeCallback: static fn (): MutatingScope => $scope->filterByFalseyValue($expr),
235233
);
236234
}
237235

src/Analyser/ExprHandler/PipeHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
8787
isAlwaysTerminating: $exprResult->isAlwaysTerminating(),
8888
throwPoints: $exprResult->getThrowPoints(),
8989
impurePoints: $exprResult->getImpurePoints(),
90-
truthyScopeCallback: static fn (): MutatingScope => $scope->filterByTruthyValue($expr),
91-
falseyScopeCallback: static fn (): MutatingScope => $scope->filterByFalseyValue($expr),
9290
);
9391
}
9492

0 commit comments

Comments
 (0)