用括号避免出现“PHP严格标准”警告?

时间:2016-04-28 16:51:45

标签: php

在以下代码中,为什么额外的括号会避免警告?

  

PHP严格标准:只应通过引用传递变量。

class Family extends Eloquent
{
    public function members()
    {
        return $this->hasMany('App\Person');
    }   
}

class Person extends Eloquent
{
    public function family()
    {
        return $this->belongsTo('App\Family');
    }

    public function school()
    {
        return $this->belongsTo('App\School');
    }
}

class School extends Eloquent
{
    public function students()
    {
        return $this->hasMany('App\Person');
    }
}

0 个答案:

没有答案