Yii1-model::validate()的声明应与CModel::validate($attributes=NULL,$clearErrors=true)兼容

Yii1-model::validate()的声明应与CModel::validate($attributes=NULL,$clearErrors=true)兼容,yii,yii1.x,Yii,Yii1.x,当我尝试在控制器内运行index方法时,出现以下错误: Declaration of OneTokenAuth::validate() should be compatible with CModel::validate($attributes = NULL, $clearErrors = true) <?php /** * Class is used for */ class OneTokenAuthController extends Controller { pub

当我尝试在控制器内运行index方法时,出现以下错误:

Declaration of OneTokenAuth::validate() should be compatible with CModel::validate($attributes = NULL, $clearErrors = true)
<?php

/**
 * Class is used for 
 */
class OneTokenAuthController extends Controller
{
    public function init()
    {
        $this->attachbehavior('restBehavior', new RestBehavior());
        parent::init();
    }

    public function filters()
    {
        return ['accessControl',];
    }

    public function accessRules()
    {
        return [
            [
                'deny',
                'actions' => [
                    'index',
                ],
                'users' =>  ['@']
            ]
        ];

    }

    /**
     * Entry point for validating JWT token
     * If the token is valid, user will be logged in as an admin 
     * and redirected to the admin dashboard
     *
     * @param [string] $t
     * @return void
     */
    function actionIndex($t){

        $token = CHtml::encode(strip_tags($t));

        $auth = new OneTokenAuth($token);

        if(!$auth->verify())
            die('Token is not valid');

        if(!$auth->validate())
            die('Token is not valid');

        $this->redirect('admin/jobs/dashboardNewest');
    }
}
我的控制器:

Declaration of OneTokenAuth::validate() should be compatible with CModel::validate($attributes = NULL, $clearErrors = true)
<?php

/**
 * Class is used for 
 */
class OneTokenAuthController extends Controller
{
    public function init()
    {
        $this->attachbehavior('restBehavior', new RestBehavior());
        parent::init();
    }

    public function filters()
    {
        return ['accessControl',];
    }

    public function accessRules()
    {
        return [
            [
                'deny',
                'actions' => [
                    'index',
                ],
                'users' =>  ['@']
            ]
        ];

    }

    /**
     * Entry point for validating JWT token
     * If the token is valid, user will be logged in as an admin 
     * and redirected to the admin dashboard
     *
     * @param [string] $t
     * @return void
     */
    function actionIndex($t){

        $token = CHtml::encode(strip_tags($t));

        $auth = new OneTokenAuth($token);

        if(!$auth->verify())
            die('Token is not valid');

        if(!$auth->validate())
            die('Token is not valid');

        $this->redirect('admin/jobs/dashboardNewest');
    }
}

派生类中的方法必须具有与父类相同的参数,您必须指定参数
$attributes
$clearErrors