| 1 | <?php | ||
| 15 | class Identity extends Model implements IdentityInterface | ||
| 16 | { | ||
| 17 | |||
| 18 | private static $ids = [ | ||
| 19 | 'user1', | ||
| 20 | 'user2', | ||
| 21 | 'user3', | ||
| 22 | ]; | ||
| 23 | |||
| 24 | private $_id; | ||
| 25 | |||
| 26 | public static function findIdentity($id) | ||
| 34 | |||
| 35 | public static function findIdentityByAccessToken($token, $type = null) | ||
| 39 | |||
| 40 | public function getId() | ||
| 44 | |||
| 45 | public function getAuthKey() | ||
| 49 | |||
| 50 | public function validateAuthKey($authKey) | ||
| 54 | |||
| 55 | public function getMfaSecretKey() | ||
| 59 | |||
| 60 | } | ||
| 61 | 
Let’s assume you have a class which uses late-static binding:
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClassto useselfinstead: