コード例 #1
0
ファイル: GenericTest.php プロジェクト: ad3n/BetterReflection
 public function testReflectWithAggregateSourceLocatorFindsClass()
 {
     $reflector = new Generic(new AggregateSourceLocator([new StringSourceLocator('<?php'), new StringSourceLocator('<?php class Foo {}')]));
     $classInfo = $reflector->reflect($this->getIdentifier('Foo', IdentifierType::IDENTIFIER_CLASS));
     $this->assertInstanceOf(ReflectionClass::class, $classInfo);
     $this->assertSame('Foo', $classInfo->getName());
 }
コード例 #2
0
 /**
  * Create a ReflectionClass for the specified $className.
  *
  * @param string $functionName
  * @return \BetterReflection\Reflection\ReflectionFunction
  */
 public function reflect($functionName)
 {
     return $this->reflector->reflect(new Identifier($functionName, new IdentifierType(IdentifierType::IDENTIFIER_FUNCTION)));
 }
コード例 #3
0
 /**
  * Get all the classes available in the scope specified by the SourceLocator.
  *
  * @return \BetterReflection\Reflection\ReflectionClass[]
  */
 public function getAllClasses()
 {
     return $this->reflector->getAllByIdentifierType(new IdentifierType(IdentifierType::IDENTIFIER_CLASS));
 }
コード例 #4
0
ファイル: GenericTest.php プロジェクト: stof/BetterReflection
 public function testReflectWithAggregateSourceLocatorFindsClass()
 {
     $this->markTestIncomplete('See https://github.com/Roave/BetterReflection/issues/123');
     $reflector = new Generic(new AggregateSourceLocator([new StringSourceLocator('<?php'), new StringSourceLocator('<?php class Foo {}')]));
     $classInfo = $reflector->reflect($this->getIdentifier('Foo', IdentifierType::IDENTIFIER_CLASS));
     $this->assertInstanceOf(ReflectionClass::class, $classInfo);
     $this->assertSame('Foo', $classInfo->getName());
 }