codecamp

PHP8 Componere\cast — 铸件

(Componere 2 >= 2.1.2)

Componere\cast — 铸件

说明

Componere\cast(Type $type, $object): Type

参数

type

用户定义的类型

object

具有与 Type 兼容的用户定义类型的对象

返回值

Type 类型的对象,从 object 转换而来

错误/异常

警告

如果对象的类型是内部类或派生自内部类,则应抛出 InvalidArgumentException

警告

如果 Type 是接口,则应抛出 InvalidArgumentException

警告

如果 Type 是一个特征,则应抛出 InvalidArgumentException

警告

如果 Type 是抽象类型,则应抛出 InvalidArgumentException

警告

如果 Type 与对象的类型不兼容,则应抛出 InvalidArgumentException

参见

  • Componere\cast_by_ref


PHP8 Componere\Value::hasDefault — 价值互动
PHP8 Componere\cast_by_ref — 铸件
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定