Created
March 11, 2016 02:15
-
-
Save egonSchiele/abe1a2da1401aa2b4988 to your computer and use it in GitHub Desktop.
Add a closure for conditionals to phan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Phan/Analysis/PreOrderAnalysisVisitor.php b/src/Phan/Analysis/PreOrderAnalysisVisitor.php | |
index 8650cd3..feaaee4 100644 | |
--- a/src/Phan/Analysis/PreOrderAnalysisVisitor.php | |
+++ b/src/Phan/Analysis/PreOrderAnalysisVisitor.php | |
@@ -508,11 +508,16 @@ class PreOrderAnalysisVisitor extends ScopeVisitor | |
*/ | |
public function visitIfElem(Node $node) : Context | |
{ | |
+ $closure_fqsen = | |
+ FullyQualifiedFunctionName::fromClosureInContext( | |
+ $this->context->withLineNumberStart($node->lineno ?? 0) | |
+ ); | |
+ | |
// Clone the scope for each branch of a conditional. | |
// They'll be merged upon existing all branches. | |
$context = $this->context->withScope( | |
clone($this->context->getScope()) | |
- ); | |
+ )->withClosureFQSEN($closure_fqsen); | |
// Look to see if any proofs we do within the condition | |
// can say anything about types within the statement |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment