public function testCanReflectEvaledTrait() { $traitName = uniqid('foo'); eval('trait ' . $traitName . ' {function foo(){}}'); $locator = new EvaledCodeSourceLocator(); $source = $locator->__invoke(new Identifier($traitName, new IdentifierType(IdentifierType::IDENTIFIER_CLASS))); $this->assertInstanceOf(EvaledLocatedSource::class, $source); $this->assertStringMatchesFormat('%Aclass%A' . $traitName . '%A', $source->getSource()); }
public function testReturnsNullForFunctions() { $locator = new EvaledCodeSourceLocator(); $this->assertNull($locator->__invoke(new Identifier('foo', new IdentifierType(IdentifierType::IDENTIFIER_FUNCTION)))); }