-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for list() in foreach (PHP 5.5)
Example: foreach ($coords as list($x, $y)) { ... } This change slightly breaks backwards compatability, as it changes the node structure for the previously existing `list(...) = $foo` assignments. Those no longer have a dedicated `AssignList` node; instead they are parsed as a normal `Assign` node with a `List` as `var`. Similarly the use in `foreach` will generate a `List` for `valueVar`.
- Loading branch information
Showing
7 changed files
with
852 additions
and
777 deletions.
There are no files selected for viewing
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* @property array $vars List of variables to assign to | ||
*/ | ||
class PHPParser_Node_Expr_List extends PHPParser_Node_Expr | ||
{ | ||
/** | ||
* Constructs a list() destructuring node. | ||
* | ||
* @param array $vars List of variables to assign to | ||
* @param array $attributes Additional attributes | ||
*/ | ||
public function __construct(array $vars, array $attributes = array()) { | ||
parent::__construct( | ||
array( | ||
'vars' => $vars, | ||
), | ||
$attributes | ||
); | ||
} | ||
} |
Oops, something went wrong.