Example #1
0
 /**
  * Extracts the package name of a qualified PHP 5.3 class identifier.
  *
  * If the class name doesn't contain a package identifier this method will
  * return the default identifier.
  *
  * <code>
  *   $namespaceName = $this->extractPackageName('foo\bar\foobar');
  *   var_dump($namespaceName);
  *   // Results in:
  *   // string(8) "foo\bar"
  *
  *   $namespaceName = $this->extractPackageName('foobar');
  *   var_dump($namespaceName);
  *   // Results in:
  *   // string(6) "+global"
  * </code>
  *
  * @param string $qualifiedName The qualified PHP 5.3 class identifier.
  *
  * @return string
  */
 protected function extractNamespaceName($qualifiedName)
 {
     if (($pos = strrpos($qualifiedName, '\\')) !== false) {
         return ltrim(substr($qualifiedName, 0, $pos), '\\');
     } elseif (Type::isInternalType($qualifiedName)) {
         return Type::getTypePackage($qualifiedName);
     }
     return self::DEFAULT_NAMESPACE;
 }
Example #2
0
 /**
  * Extracts non scalar types from a field doc comment and creates a
  * matching type instance.
  *
  * @return \PDepend\Source\AST\ASTClassOrInterfaceReference
  * @since  0.9.6
  */
 private function parseFieldDeclarationClassOrInterfaceReference()
 {
     $annotations = $this->parseVarAnnotation($this->docComment);
     foreach ($annotations as $annotation) {
         if (Type::isScalarType($annotation) === false) {
             return $this->builder->buildAstClassOrInterfaceReference($annotation);
         }
     }
     return null;
 }
 /**
  * testIsArrayPerformsCheckCaseInsensitive
  *
  * @return void
  */
 public function testIsArrayPerformsCheckCaseInsensitive()
 {
     $this->assertTrue(Type::isArrayType('ArRaY'));
 }