public static concat ( string | array | self | null $name1, string | array | self | null $name2, array $attributes = [] ) : static | null | ||
$name1 | string | array | self | null | The first name |
$name2 | string | array | self | null | The second name |
$attributes | array | Attributes to assign to concatenated name |
Résultat | static | null | Concatenated name |
public static function concat($name1, $name2, array $attributes = [])
{
if (null === $name1 && null === $name2) {
return null;
} elseif (null === $name1) {
return new static(self::prepareName($name2), $attributes);
} else {
if (null === $name2) {
return new static(self::prepareName($name1), $attributes);
} else {
return new static(array_merge(self::prepareName($name1), self::prepareName($name2)), $attributes);
}
}
}
protected function addAlias(Stmt\UseUse $use, $type, Name $prefix = null) { parent::addAlias($use, $type, $prefix); if ($type == Stmt\Use_::TYPE_NORMAL) { // Add prefix for group uses $name = strval($prefix ? Name::concat($prefix, $use->name) : $use->name); $this->classAliases[$use->alias] = $name; } }