I'm trying to get type $bar
variable.
<?php
class Foo
{
public function test(stdClass $bar)
{
}
}
$reflect = new ReflectionClass('Foo');
foreach ($reflect->getMethods() as $method) {
foreach ($method->getParameters() as $num => $parameter) {
var_dump($parameter->getType());
}
}
I expect stdClass
but I get
Call to undefined method ReflectionParameter::getType()
What can be wrong? Or there is some another way?..
$ php -v
PHP 5.4.41 (cli) (built: May 14 2015 02:34:29)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
Aucun commentaire:
Enregistrer un commentaire