1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-26 20:04:48 +01:00

Add Variable and PropertyFetch node constructors

This commit is contained in:
Eridan Domoratskiy 2018-07-20 14:39:38 +03:00 committed by Nikita Popov
parent 5aeb884ab5
commit 6751ac3c9d

View File

@ -145,6 +145,17 @@ class BuilderFactory
return BuilderHelpers::normalizeValue($value);
}
/**
* Creates variable node.
*
* @param string|Expr $name Name
*
* @return Expr\Variable
*/
public function var($name) : Expr\Variable {
return new Expr\Variable($name);
}
/**
* Normalizes an argument list.
*
@ -240,6 +251,18 @@ class BuilderFactory
public function constFetch($name) : Expr\ConstFetch {
return new Expr\ConstFetch(BuilderHelpers::normalizeName($name));
}
/**
* Creates a property fetch node.
*
* @param Expr $var Variable holding object
* @param string|Identifier|Expr $name Property name
*
* @return Expr\PropertyFetch
*/
public function propertyFetch(Expr $var, $name) : Expr\PropertyFetch {
return new Expr\PropertyFetch($var, $name);
}
/**
* Creates a class constant fetch node.