For example there is Foo class object. Not try-catch expression
class Foo {
function Bar($a){
}
}
$foo = new Foo();
if(hasRequiredParams(Object $foo, MethodName 'Bar')){
do something;
}
You can do this with reflection:
class Foo {
function Bar($a) {
}
}
$rc = new ReflectionClass('Foo');
$rm = $rc->getMethod('Bar');
var_dump($rm->getNumberOfRequiredParameters()); // 1
However, just because you can do this, it doesn't mean you should. There may be reasons for needing to inspect the method signature at run-time, but in most cases you shouldn't be basing your application logic on this information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With