得到一个错误的双精度和布尔甚至布尔给定


Getting an error for double and boolean even boolean given

在SO上可用的一个问题之前,即如何解决;传递给my_function()的参数1必须是string的实例,string given"在PHP 7之前。我对此进行了测试但是doubleboolean出现了奇怪的错误

Uncaught TypeError:参数5传递给A::getData()必须是double类型的实例,float给定,未捕获的TypeError:传递给A::getData()的参数6必须是boolean的实例,boolean给定,

class A{
    /**
     * [getData description]
     * @param  array   $data [description]
     * @param  string  $a    [description]
     * @param  int     $b    [description]
     * @param  boolean $c    [description]
     * @param  float   $d    [description]
     * @return [type]        [description]
     */
    public function getData(array $data, string $a, int $b,  float $f, double $d, boolean $c)
    {}
}
$a = new A();
$a->getData(["as"],"assasa",12345, 64.153454, 65.41, true);

可以点击这里

没有双类型提示。布尔值应该改成bool值。你的PHPDoc控件与参数不匹配

     /**
     * [getData description]
     * @param  array   $data [description]
     * @param  string  $a    [description]
     * @param  int     $b    [description]
     * @param  double   $f    [description]
     * @param  float $d     [description]
     * @param  bool $c    [description]
     * @return [type]        [description]
     */
     public function getData(array $data, string $a, int $b, $f, float $d, bool $c)
     {
     } 

$a->getData(["as"],"assasa",12345,65.41,64.153454 , true);