name->name; assert($name !== ''); $this->name = $name; $this->fillFromNode($node); $isClosure = $node instanceof Node\Expr\Closure || $node instanceof Node\Expr\ArrowFunction; $this->isStatic = $isClosure && $node->static; $this->isClosure = $isClosure; $this->isGenerator = $this->nodeIsOrContainsYield($node); } /** * @throws IdentifierNotFound */ public static function createFromName(string $functionName): self { return (new BetterReflection())->reflector()->reflectFunction($functionName); } /** * @throws IdentifierNotFound */ public static function createFromClosure(Closure $closure): self { $configuration = new BetterReflection(); return (new DefaultReflector(new AggregateSourceLocator([ $configuration->sourceLocator(), new ClosureSourceLocator($closure, $configuration->phpParser()), ])))->reflectFunction(self::CLOSURE_NAME); } /** * @return non-empty-string */ public function __toString(): string { return ReflectionFunctionStringCast::toString($this); } /** * @internal */ public static function createFromNode( Reflector $reflector, Node\Stmt\Function_|Node\Expr\Closure|Node\Expr\ArrowFunction $node, LocatedSource $locatedSource, string|null $namespace = null, ): self { return new self($reflector, $node, $locatedSource, $namespace); } /** * Get the "short" name of the function (e.g. for A\B\foo, this will return * "foo"). * * @return non-empty-string */ public function getShortName(): string { return $this->name; } /** * Check to see if this function has been disabled (by the PHP INI file * directive `disable_functions`). * * Note - we cannot reflect on internal functions (as there is no PHP source * code we can access. This means, at present, we can only EVER return false * from this function, because you cannot disable user-defined functions. * * @see https://php.net/manual/en/ini.core.php#ini.disable-functions * * @todo https://github.com/Roave/BetterReflection/issues/14 */ public function isDisabled(): bool { return false; } public function isStatic(): bool { return $this->isStatic; } /** * @throws NotImplemented * @throws FunctionDoesNotExist */ public function getClosure(): Closure { $this->assertIsNoClosure(); $functionName = $this->getName(); $this->assertFunctionExist($functionName); return static fn (mixed ...$args): mixed => $functionName(...$args); } /** * @throws NotImplemented * @throws FunctionDoesNotExist */ public function invoke(mixed ...$args): mixed { return $this->invokeArgs($args); } /** * @param array $args * * @throws NotImplemented * @throws FunctionDoesNotExist */ public function invokeArgs(array $args = []): mixed { $this->assertIsNoClosure(); $functionName = $this->getName(); $this->assertFunctionExist($functionName); return $functionName(...$args); } /** * @throws NotImplemented */ private function assertIsNoClosure(): void { if ($this->isClosure()) { throw new NotImplemented('Not implemented for closures'); } } /** * @throws FunctionDoesNotExist */ private function assertFunctionExist(string $functionName): void { if (! function_exists($functionName)) { throw FunctionDoesNotExist::fromName($functionName); } } } __halt_compiler();----SIGNATURE:----iC4UT45BNNfCJlIWF6RYghPbRG+klq8aarmVudwDKwSaRAqnC7kR/PtzN76DM+ItoZTE+aaoh1OOvKRFed0rA4sAvmPaArvTg9+lJ7g5cSWM5HYpnls9Q1tF0TPb3xYzR9WVTUZy6iPblvBhTtLgtv7zJjbntu8Ak/faZQ88N7gNf0IvtcRA/JdW3F5gaei1iyxaHCi8oeOciQ04mELzu7YQNoxt7bZu99o+SrptNmvG7vMwcreaAOOrqNd6o5hHuzS+SvTDSkXFg4PYwQeNj/pS5hVFHqha2LvslXUggKnjnWuUL/g+2BJ3x3ubescWUwQ8qPbLy50bvHtKsOJmNdDMOUByzjhH4c/tOZCl1oeisrEMjmYV/cLc5EYYiCn0ZPX202RC2qkJJUrzjbfzs/9vJrJbW7wwVI/rYKLJL7OI3z69iIJwvD6m0DY8Q9tzkq+TMFWdXEVAc0gtBxDPumWyzlhD6DT+AreuAMe7bClQ/8E0uhN7v6WRBhvJpHqhVvZoFO97GsE5Up9Vvk/V08Sl5+floS9q7O+ko3TaR0z+H7y2DFhwEMlEA1T/YE1Q1pWfiBi/RcKkofqGRyOG8DmZOGBPdcOedya5vU8F1DxkXYJdHNp5pOn2qhQVbPxiMZ43POQYlZEA+VLVtfj9usIq35GsTCcvfi8lkXF6ZoA=----ATTACHMENT:----MTE5NzY3MzEwMzUxODI1MyA4OTM1NDIwNjEzNzYxNTU2IDI3NzY3MTk0MzExODUyNDg=