Allow to pass a string to the constructor of Node_Name

This commit is contained in:
nikic 2011-08-09 15:23:18 +02:00
parent f67ff50550
commit 818eb3940b

View File

@ -13,12 +13,16 @@ class PHPParser_Node_Name extends PHPParser_NodeAbstract
/**
* Constructs a name node.
*
* @param array $parts Parts of the name
* @param int $type Resolve type
* @param int $line Line
* @param null|string $docComment Nearest doc comment
* @param string|array $parts Parts of the name (or name as string)
* @param int $type Resolve type
* @param int $line Line
* @param null|string $docComment Nearest doc comment
*/
public function __construct(array $parts, $type = self::NORMAL, $line = -1, $docComment = null) {
public function __construct($parts, $type = self::NORMAL, $line = -1, $docComment = null) {
if (!is_array($parts)) {
$parts = explode('\\', $parts);
}
parent::__construct(
array(
'parts' => $parts,