/**
  * Process and reflect all the matching identifiers found inside a namespace node.
  *
  * @param Reflector $reflector
  * @param Node\Stmt\Namespace_ $namespace
  * @param IdentifierType $identifierType
  * @param LocatedSource $locatedSource
  * @return \BetterReflection\Reflection\Reflection[]
  */
 private function reflectFromNamespace(Reflector $reflector, Node\Stmt\Namespace_ $namespace, IdentifierType $identifierType, LocatedSource $locatedSource)
 {
     $reflections = [];
     foreach ($namespace->stmts as $node) {
         $reflection = $this->reflectNode($reflector, $node, $locatedSource, $namespace);
         if (null !== $reflection && $identifierType->isMatchingReflector($reflection)) {
             $reflections[] = $reflection;
         }
     }
     return $reflections;
 }
 public function testIsTypesForFunction()
 {
     $functionType = new IdentifierType(IdentifierType::IDENTIFIER_FUNCTION);
     $this->assertFalse($functionType->isClass());
     $this->assertTrue($functionType->isFunction());
 }
 public function testIsMatchingReflector()
 {
     $reflectionClass = $this->getMockBuilder(ReflectionClass::class)->disableOriginalConstructor()->getMock();
     $classType = new IdentifierType(IdentifierType::IDENTIFIER_CLASS);
     $this->assertTrue($classType->isMatchingReflector($reflectionClass));
 }
Beispiel #4
0
 /**
  * @return bool
  */
 public function isFunction()
 {
     return $this->type->isFunction();
 }