Skip to content

Commit

Permalink
Use RegexIterator in docs (by @lstrojny)
Browse files Browse the repository at this point in the history
Also fix formatting in changelog and be more specific in a doc comment.
  • Loading branch information
nikic committed Dec 21, 2012
1 parent eeb5e89 commit 222c961
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Expand Up @@ -8,8 +8,8 @@ Version 0.9.3 (22.11.2012)

* [BC] As `list()` in `foreach` is now supported the structure of list assignments changed:

1. There is no longer a dedicated `AssignList` node; instead a normal `Assign` node is used with a `List` as `var`.
2. Nested lists are now `List` nodes too, instead of just arrays.
1. There is no longer a dedicated `AssignList` node; instead a normal `Assign` node is used with a `List` as `var`.
2. Nested lists are now `List` nodes too, instead of just arrays.

* [BC] As arbitrary expressions are allowed in `empty()` now its subnode was renamed from `var` to `expr`.

Expand Down
13 changes: 4 additions & 9 deletions doc/2_Usage_of_basic_components.markdown
Expand Up @@ -288,16 +288,11 @@ $prettyPrinter = new PHPParser_PrettyPrinter_Zend;
$traverser->addVisitor(new PHPParser_NodeVisitor_NameResolver); // we will need resolved names
$traverser->addVisitor(new NodeVisitor_NamespaceConverter); // our own node visitor

// iterate over all files in the directory
foreach (new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(IN_DIR),
RecursiveIteratorIterator::LEAVES_ONLY)
as $file) {
// only convert .php files
if (!preg_match('~\.php$~', $file)) {
continue;
}
// iterate over all .php files in the directory
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(IN_DIR));
$files = new RegexIterator($files, '/\.php$/');

foreach ($files as $file) {
try {
// read the file that should be converted
$code = file_get_contents($file);
Expand Down
2 changes: 1 addition & 1 deletion grammar/kmyacc.php.parser
Expand Up @@ -157,7 +157,7 @@ class #(-p)
*
* @param string $code The source code to parse
*
* @return array Array of statements
* @return PHPParser_Node[] Array of statements
*/
public function parse($code) {
$this->lexer->startLexing($code);
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPParser/Parser.php
Expand Up @@ -939,7 +939,7 @@ public function __construct(PHPParser_Lexer $lexer) {
*
* @param string $code The source code to parse
*
* @return array Array of statements
* @return PHPParser_Node[] Array of statements
*/
public function parse($code) {
$this->lexer->startLexing($code);
Expand Down

0 comments on commit 222c961

Please sign in to comment.