Add useFunction() and useConst() builder methods

This commit is contained in:
Eridan Domoratskiy 2018-07-19 17:54:04 +03:00 committed by Nikita Popov
parent bd088dc940
commit 53c732a96d

View File

@ -104,7 +104,7 @@ class BuilderFactory
/**
* Creates a namespace/class use builder.
*
* @param string|Node\Name $name Name to alias
* @param Node\Name|string $name Name of the entity (namespace or class) to alias
*
* @return Builder\Use_ The create use builder
*/
@ -112,6 +112,28 @@ class BuilderFactory
return new Builder\Use_($name, Use_::TYPE_NORMAL);
}
/**
* Creates a function use builder.
*
* @param Node\Name|string $name Name of the function to alias
*
* @return Builder\Use_ The create use builder
*/
public function useFunction($name) : Builder\Use_ {
return new Builder\Use_($name, Use_::TYPE_FUNCTION);
}
/**
* Creates a constant use builder.
*
* @param Node\Name|string $name Name of the const to alias
*
* @return Builder\Use_ The create use builder
*/
public function useConst($name) : Builder\Use_ {
return new Builder\Use_($name, Use_::TYPE_CONSTANT);
}
/**
* Creates node a for a literal value.
*