Reputation: 501
got this error on Yii2. I dont know what exactly the problem is. I just migrate my source code from Windows to Mac OS. I tried cloning my whole project still the error appears.
Declaration of common\models\Product::getAttributes() should be compatible with yii\base\Model::getAttributes($names = NULL, $except = Array)
These are the things i tried:
I am using yii2 in this project.
Upvotes: 0
Views: 552
Reputation: 756
Your method must accept the same parameters ($names = NULL, $except = Array)
Upvotes: 0
Reputation: 33548
As you can see from the error message, you overrided yii\base\Model
getAttributes()
method. common\models\Product
is extended from yii\db\ActiveRecord
and ActiveRecord
is extended from yii\base\Model
.
If you really want to override this method, list all parameters (see here), it's easier to do with help of IDE. And by the way this is PHP feature and has nothing to do with OS or Yii2.
If it is your custom method for another purposes, you need to rename it in order to resolve conflict.
Upvotes: 2