In yii2/models/User.php struck-through Object. Why?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
9 views
Here is the code from User.php

<?phpnamespace app\\models;class User extends \\yii\\base\\Object implements \\yii\\web\\IdentityInterface{public $id;public $username;public $password;public $authKey;public $accessToken;private static $users = ['100' => [ 'id' => '100', 'username' => 'admin', 'password' => 'admin', 'authKey' => 'test100key', 'accessToken' => '100-token', ], '101' => [ 'id' => '101', 'username' => 'demo', 'password' => 'demo', 'authKey' => 'test101key', 'accessToken' => '101-token', ], ]; /** * @inheritdoc */ public static function findIdentity($id) { return isset(self::$users[$id]) ? new static(self::$users[$id]) : null; } /** * @inheritdoc */ public static function findIdentityByAccessToken($token, $type = null) { foreach (self::$users as $user) { if ($user['accessToken'] === $token) { return new static($user); } } return null; } /** * Finds user by username * * @param string $username * @return static|null */ public static function findByUsername($username) { foreach (self::$users as $user) { if (strcasecmp($user['username'], $username) === 0) { return new static($user); } } return null; } /** * @inheritdoc */ public function getId() { return $this->id; } /** * @inheritdoc */ public function getAuthKey() { return $this->authKey; } /** * @inheritdoc */ public function validateAuthKey($authKey) { return $this->authKey === $authKey; } /** * Validates password * * @param string $password password to validate * @return bool if password provided is valid for current user */ public function validatePassword($password) { return $this->password === $password; } }


Namely, it is crossed out in this line
class User extends \\yii\\base\\Object implements \\yii\\web\\IdentityInterface {
by | 9 views

1 Answer

0 like 0 dislike
https://www.yiiframework.com/doc/api/2.0/yii-base-...
Starting in 2.0.13 yii\\base\\Object in yii is deprecated since declared support for PHP7.2, in which the Object is reserved by the language. Use yii\\base\\baseObject instead.
by

Related questions

0 like 0 dislike
2 answers
asked Jun 8, 2019 by criminalist
0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
asked May 2, 2019 by alehandroWEB
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
asked Apr 20, 2019 by Sergalas
110,608 questions
257,186 answers
0 comments
35,457 users