ReflectionParameter 类

(PHP 5, PHP 7, PHP 8)

简介

ReflectionParameter 检索函数或方法参数的相关信息。

要自行检查函数的参数,首先创建 ReflectionFunctionReflectionMethod 的实例,然后使用它们的 ReflectionFunctionAbstract::getParameters() 方法来检索参数的数组。

类摘要

class ReflectionParameter implements Reflector {
/* 属性 */
public string $name;
/* 方法 */
public __construct(string|array|object $function, int|string $param)
public allowsNull(): bool
public canBePassedByValue(): bool
private __clone(): void
public static export(string $function, string $parameter, bool $return = ?): string
public getAttributes(?string $name = null, int $flags = 0): array
public getDefaultValueConstantName(): ?string
public getName(): string
public getPosition(): int
public hasType(): bool
public isArray(): bool
public isCallable(): bool
public isDefaultValueConstant(): bool
public isOptional(): bool
public isPassedByReference(): bool
public isVariadic(): bool
public __toString(): string
}

属性

name

参数名。只读,在尝试赋值的时候会抛出 ReflectionException

更新日志

版本 说明
8.0.0 已移除 ReflectionParameter::export()

目录

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top