Creates a new function reflection instance from the supplied callable.
public static fromCallable ( callable $callable ) : self | ||
$callable | callable | |
return | self |
/** * @dataProvider expressions */ public function testExpressionCompilation($phpCallable, $expectedSql) { // Parse the first statement from callable into an expression tree. $expression = FunctionInterpreter::getDefault()->getStructure(FunctionReflection::fromCallable($phpCallable))->getBodyExpressions()[0]; $compiler = new ExpressionCompiler(new Select($this->pdo, new TableSourceInfo('table'), new ParameterCollection())); $this->assertSame($expectedSql, $compiler->compile($expression), 'PHP Code: ' . $expression->compile()); }