Lines Matching refs:name

50      * @param Name $name Original name
55 … public function addAlias(Name $name, string $aliasName, int $type, array $errorAttrs = []): void { argument
73 $typeStringMap[$type], $name, $aliasName
80 $this->aliases[$type][$aliasLookupName] = $name;
81 $this->origAliases[$type][$aliasName] = $name;
96 * @param Name $name Name to resolve
101 public function getResolvedName(Name $name, int $type): ?Name { argument
103 if ($type === Stmt\Use_::TYPE_NORMAL && $name->isSpecialClassName()) {
104 if (!$name->isUnqualified()) {
106 sprintf("'\\%s' is an invalid class name", $name->toString()),
107 $name->getAttributes()
110 return $name;
114 if ($name->isFullyQualified()) {
115 return $name;
119 if (null !== $resolvedName = $this->resolveAlias($name, $type)) {
123 if ($type !== Stmt\Use_::TYPE_NORMAL && $name->isUnqualified()) {
126 return new FullyQualified($name, $name->getAttributes());
134 return FullyQualified::concat($this->namespace, $name, $name->getAttributes());
140 * @param Name $name Class ame to resolve
144 public function getResolvedClassName(Name $name): Name { argument
145 return $this->getResolvedName($name, Stmt\Use_::TYPE_NORMAL);
151 * @param string $name Fully-qualified name (without leading namespace separator)
156 public function getPossibleNames(string $name, int $type): array { argument
157 $lcName = strtolower($name);
162 return [new Name($name)];
167 $possibleNames = [new FullyQualified($name)];
169 if (null !== $nsRelativeName = $this->getNamespaceRelativeName($name, $lcName, $type)) {
181 $possibleNames[] = new Name($alias . substr($name, strlen($lcOrig)));
190 if ($normalizedOrig === $this->normalizeConstName($name)) {
207 * @param string $name Fully-qualified name (without leading namespace separator)
212 public function getShortName(string $name, int $type): Name { argument
213 $possibleNames = $this->getPossibleNames($name, $type);
229 private function resolveAlias(Name $name, int $type): ?FullyQualified { argument
230 $firstPart = $name->getFirst();
232 if ($name->isQualified()) {
237 return FullyQualified::concat($alias, $name->slice(1), $name->getAttributes());
239 } elseif ($name->isUnqualified()) {
244 … return new FullyQualified($this->aliases[$type][$checkName], $name->getAttributes());
252 private function getNamespaceRelativeName(string $name, string $lcName, int $type): ?Name { argument
254 return new Name($name);
261 return new Name($name);
267 return new Name(substr($name, strlen($namespacePrefix)));
273 private function normalizeConstName(string $name): string { argument
274 $nsSep = strrpos($name, '\\');
276 return $name;
280 $ns = substr($name, 0, $nsSep);
281 $shortName = substr($name, $nsSep + 1);