Skip to content

Instantly share code, notes, and snippets.

View ureimers's full-sized avatar

Ulf ureimers

  • BIMP
  • Hamburg, Germany
View GitHub Profile
@Raphhh
Raphhh / CallableReflection.php
Last active December 20, 2015 22:18
PHP Callable Reflection: You can reflect a callback and know its type.
<?php
use TRex\Reflection\CallableReflection;
//examples
$closure = function(){};
$reflect = new CallableReflection($closure);
var_dump($reflect->getType()===CallableReflection::CLOSURE_TYPE);
var_dump($reflect->getFunctionName()==='');
var_dump($reflect->getClosure()===$closure);
var_dump($reflect->getClassName()==='');