isUnqualified() публичный Метод

Checks whether the name is unqualified. (E.g. Name)
public isUnqualified ( ) : boolean
Результат boolean Whether the name is unqualified
Пример #1
0
 protected function resolveOtherName(Name $name, $type)
 {
     // fully qualified names are already resolved
     if ($name->isFullyQualified()) {
         return $name;
     }
     // resolve aliases for qualified names
     $aliasName = strtolower($name->getFirst());
     if ($name->isQualified() && isset($this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName])) {
         $name->setFirst($this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName]);
     } elseif ($name->isUnqualified()) {
         if ($type === Stmt\Use_::TYPE_CONSTANT) {
             // constant aliases are case-sensitive, function aliases case-insensitive
             $aliasName = $name->getFirst();
         }
         if (isset($this->aliases[$type][$aliasName])) {
             // resolve unqualified aliases
             $name->set($this->aliases[$type][$aliasName]);
         } else {
             // unqualified, unaliased names cannot be resolved at compile-time
             return $name;
         }
     } elseif (null !== $this->namespace) {
         // if no alias exists prepend current namespace
         $name->prepend($this->namespace);
     }
     return new Name\FullyQualified($name->parts, $name->getAttributes());
 }
 protected function handleScalarTypes(Name $name)
 {
     $scalarTypes = ['bool' => true, 'int' => true, 'float' => true, 'string' => true];
     if (!$name->isUnqualified()) {
         return $name;
     }
     $lowerName = strtolower($name->toString());
     return isset($scalarTypes[$lowerName]) ? $lowerName : $name;
 }
Пример #3
0
 protected function resolveOtherName(Name $name, $type)
 {
     // fully qualified names are already resolved
     if ($name->isFullyQualified()) {
         return $name;
     }
     // resolve aliases for qualified names
     $aliasName = strtolower($name->getFirst());
     if ($name->isQualified() && isset($this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName])) {
         $alias = $this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName];
         return FullyQualified::concat($alias, $name->slice(1), $name->getAttributes());
     }
     if ($name->isUnqualified()) {
         if ($type === Stmt\Use_::TYPE_CONSTANT) {
             // constant aliases are case-sensitive, function aliases case-insensitive
             $aliasName = $name->getFirst();
         }
         if (isset($this->aliases[$type][$aliasName])) {
             // resolve unqualified aliases
             return new FullyQualified($this->aliases[$type][$aliasName], $name->getAttributes());
         }
         if (null === $this->namespace) {
             // outside of a namespace unaliased unqualified is same as fully qualified
             return new FullyQualified($name, $name->getAttributes());
         }
         // unqualified names inside a namespace cannot be resolved at compile-time
         // add the namespaced version of the name as an attribute
         $name->setAttribute('namespacedName', FullyQualified::concat($this->namespace, $name, $name->getAttributes()));
         return $name;
     }
     // if no alias exists prepend current namespace
     return FullyQualified::concat($this->namespace, $name, $name->getAttributes());
 }