如何在php中声明参数类型时将float传递给函数

when i used wStrict typing, whatever I pass to the function, fatal error accurs :

function quote(float $a){
    var_dump(func_get_args());
}
quote(1.1071212);

Catchable fatal error: Argument 1 passed to quote() must be an instance of float, double given

function quote(double $a){
    var_dump(func_get_args());
}
quote(1.1071212);

Catchable fatal error: Argument 1 passed to quote() must be an instance of double, double given, called

You're probably doing this in PHP 5? In which case scalar type hinting hadn't been introduced yet.

Instead it thinks float and double are classes that you're trying to type-hint.

The first one works in PHP 7 though. I've made example demonstrations of this for you here:

https://3v4l.org/A86Oo

https://3v4l.org/YLKEU