Parcourir la source

Changed usage of self to static to allow extendibility

code style section has been added here:
https://github.com/yiisoft/yii2/wiki/Core-framework-code-style#self-vs-static

verification code for properties:
https://gist.github.com/cebe/7566916
Carsten Brandt il y a 12 ans
Parent
commit
6aa0755eeb
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      models/User.php

+ 2 - 2
models/User.php

@@ -26,14 +26,14 @@ class User extends \yii\base\Object implements \yii\web\IdentityInterface
 
 	public static function findIdentity($id)
 	{
-		return isset(self::$users[$id]) ? new self(self::$users[$id]) : null;
+		return isset(self::$users[$id]) ? new static(self::$users[$id]) : null;
 	}
 
 	public static function findByUsername($username)
 	{
 		foreach (self::$users as $user) {
 			if (strcasecmp($user['username'], $username) === 0) {
-				return new self($user);
+				return new static($user);
 			}
 		}
 		return null;