# The ReflectionParameter class

(PHP 5, PHP 7)

## 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 $name ;
/* Methods */
public allowsNull ( void ) : bool
public canBePassedByValue ( void ) : bool
final private __clone ( void ) : void
public __construct ( callable `$function` , mixed `$parameter` )
public static export ( string `$function` , string `$parameter` [, bool `$return` ] ) : string
public getClass ( void ) : ReflectionClass
public getDeclaringClass ( void ) : ReflectionClass
public getDeclaringFunction ( void ) : ReflectionFunctionAbstract
public getDefaultValue ( void ) : mixed
public getDefaultValueConstantName ( void ) : string
public getName ( void ) : string
public getPosition ( void ) : int
public getType ( void ) : ReflectionType
public hasType ( void ) : bool
public isArray ( void ) : bool
public isCallable ( void ) : bool
public isDefaultValueAvailable ( void ) : bool
public isDefaultValueConstant ( void ) : bool
public isOptional ( void ) : bool
public isPassedByReference ( void ) : bool
public isVariadic ( void ) : bool
public __toString ( void ) : string
}

## Properties

name

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

## Table of Contents

- ReflectionParameter::allowsNull — Checks if null is allowed
- ReflectionParameter::canBePassedByValue — Returns whether this parameter can be passed by value
- ReflectionParameter::__clone — Clone
- ReflectionParameter::__construct — Construct
- ReflectionParameter::export — Exports
- ReflectionParameter::getClass — Get the type hinted class
- ReflectionParameter::getDeclaringClass — Gets declaring class
- ReflectionParameter::getDeclaringFunction — Gets declaring function
- ReflectionParameter::getDefaultValue — Gets default parameter value
- ReflectionParameter::getDefaultValueConstantName — Returns the default value's constant name if default value is constant or null
- ReflectionParameter::getName — Gets parameter name
- ReflectionParameter::getPosition — Gets parameter position
- ReflectionParameter::getType — Gets a parameter's type
- ReflectionParameter::hasType — Checks if parameter has a type
- ReflectionParameter::isArray — Checks if parameter expects an array
- ReflectionParameter::isCallable — Returns whether parameter MUST be callable
- ReflectionParameter::isDefaultValueAvailable — Checks if a default value is available
- ReflectionParameter::isDefaultValueConstant — Returns whether the default value of this parameter is a constant
- ReflectionParameter::isOptional — Checks if optional
- ReflectionParameter::isPassedByReference — Checks if passed by reference
- ReflectionParameter::isVariadic — Checks if the parameter is variadic
- ReflectionParameter::__toString — To string