Created
March 17, 2014 18:59
-
-
Save thekid/9605952 to your computer and use it in GitHub Desktop.
Test script for https://github.com/facebook/hhvm/issues/2057
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function with_array(array $a) { } | |
| function with_callable(callable $c) { } | |
| function with_class(Exception $e) { } | |
| function with_primitive($p) { } | |
| if (strstr($argv[1], '::')) { | |
| $param= new ReflectionParameter(explode('::', $argv[1]), 0); | |
| } else { | |
| $param= new ReflectionParameter($argv[1], 0); | |
| } | |
| if ($param->isArray()) { | |
| echo "Array\n"; | |
| } else if ($param->isCallable()) { | |
| echo "Callable\n"; | |
| } else if (null !== ($class= $param->getClass())) { | |
| echo "Class ", $class->getName(), "\n"; | |
| } else { | |
| echo "Primitive\n"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment