Error when passing string into method with type hinting

后端 未结 5 2072
北荒
北荒 2020-12-20 11:11

In the code below I call a function (it happens to be a constructor) in which I have type hinting. When I run the code I get the following error:

Catchable fatal

5条回答
  •  爱一瞬间的悲伤
    2020-12-20 11:53

    Type hinting can only be used for object data types (or arrays since 5.1), not for the basic types like string, integer, float, boolean

提交回复
热议问题