How to use the ReflectionParameter class in PHP for obtaining information about function and method parameters and their attributes?

How to use the ReflectionParameter class in PHP for obtaining information about function and method parameters and their attributes? I can get the information about the function (in class constructor) and the method which uses it: $function. The condition inside the function which I want to be called is $type: