Created
August 13, 2018 08:50
-
-
Save kobus1998/fa8a74a526007897bce88652be47e2af to your computer and use it in GitHub Desktop.
PHP Reflection get type hint
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 | |
class X { | |
public function get(array $arr) { | |
return $arr; | |
} | |
} | |
$reflect = new ReflectionMethod('X', 'get'); | |
// first param for sake of example | |
$param = @reset($reflect->getParameters()); | |
print_r($param->getType()->getName()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment