The ReflectionParameter class

Introduction

The ReflectionParameter class retrieves information about function's or method's parameters.

To introspect function parameters, first create an instance of the ReflectionFunction or ReflectionMethod classes and then use their ReflectionFunctionAbstract::getParameters method to retrieve an array of parameters.

Class synopsis

ReflectionParameter
implements Reflector
/* Properties */
public string $name;
/* Methods */
public __construct(stringarrayobject $function, intstring $param)
public bool allowsNull()
public bool canBePassedByValue()
private void __clone()
public static string export(string $function, string $parameter, bool $return = ?)
public array getAttributes(stringnull $name = null, int $flags = 0)
public ReflectionClassnull getClass()
public ReflectionClassnull getDeclaringClass()
public ReflectionFunctionAbstract getDeclaringFunction()
public mixed getDefaultValue()
public stringnull getDefaultValueConstantName()
public string getName()
public int getPosition()
public ReflectionTypenull getType()
public bool hasType()
public bool isArray()
public bool isCallable()
public bool isDefaultValueAvailable()
public bool isDefaultValueConstant()
public bool isOptional()
public bool isPassedByReference()
public bool isVariadic()
public string __toString()

Properties

name

Name of the parameter. Read-only, throws ReflectionException in attempt to write.

Changelog

Version Description
8.0.0 ReflectionParameter::export was removed.
Table of Contents