Conversation
$this->context->addVariable($symbol); | ||
} | ||
if ($var->name instanceof Node\Expr\Variable) { | ||
// TODO what should we do here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just create the variable. It is the job of the analyzer to notice the usage of variable variables but the compiler should work with it.
The whole passSymbol method has to be refactored later into compiler and analyzer part (and the other pass methods in this class too)
/** | ||
* @return string | ||
*/ | ||
public function arrayPropertyAccessVariable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be best if we had one test for each case where it doesn't create a notice.
21c2743
to
197b025
Compare
I updated the PR :) |
// $array[] = … | ||
if ($expr->var instanceof Expr\Variable) { | ||
$result = $this->analyzeVar($expr->var, $context); | ||
} else if ($expr->var instanceof Expr\PropertyFetch) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else if
=> elseif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed :)
36fdea5
to
3a05895
Compare
This PR does several (related) things:
list()
handling: it previously emitted notices and failed to detect variables created using this contruct