Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Improve list() handling #129

Merged
merged 3 commits into from Sep 28, 2016
Merged

Improve list() handling #129

merged 3 commits into from Sep 28, 2016

Conversation

K-Phoen
Copy link
Collaborator

@K-Phoen K-Phoen commented Sep 16, 2016

This PR does several (related) things:

  • fixes list() handling: it previously emitted notices and failed to detect variables created using this contruct
  • removes a debug statement
  • improves the variable variable detection

$this->context->addVariable($symbol);
}
if ($var->name instanceof Node\Expr\Variable) {
// TODO what should we do here?
Copy link
Collaborator

@ddmler ddmler Sep 16, 2016

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()
Copy link
Collaborator

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.

@K-Phoen
Copy link
Collaborator Author

K-Phoen commented Sep 22, 2016

I updated the PR :)

// $array[] = …
if ($expr->var instanceof Expr\Variable) {
$result = $this->analyzeVar($expr->var, $context);
} else if ($expr->var instanceof Expr\PropertyFetch) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else if => elseif

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed :)

@K-Phoen K-Phoen force-pushed the better-list-handling branch 2 times, most recently from 36fdea5 to 3a05895 Compare September 28, 2016 18:34
@K-Phoen K-Phoen merged commit b80cb50 into ovr:master Sep 28, 2016
@K-Phoen K-Phoen deleted the better-list-handling branch September 28, 2016 18:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants