for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* _ __ __ _____ _____ ___ ____ _____
* | | / // // ___//_ _// || __||_ _|
* | |/ // /(__ ) / / / /| || | | |
* |___//_//____/ /_/ /_/ |_||_| |_|
* @link https://vistart.me/
* @copyright Copyright (c) 2016 - 2017 vistart
* @license https://vistart.me/license/
*/
namespace rhosocial\user\components;
use rhosocial\user\rbac\roles\Admin;
use rhosocial\user\rbac\roles\Webmaster;
use yii\base\Event;
* Class User
* @package rhosocial\user\web\components
* @version 1.0
* @author vistart <[email protected]>
class User extends \rhosocial\base\models\web\User
{
public function init()
parent::init();
$this->on(static::EVENT_AFTER_LOGIN, [$this, 'onRecordLogin']);
}
* @param Event $event
public function onRecordLogin($event)
return $event->sender->identity->recordLogin();
* @return bool|mixed
public function getIsAdmin()
if ($this->getIsGuest()) {
return false;
return $this->can((new Admin)->name, $this->identity);
$this->identity
object<yii\web\IdentityInterface>|null
array
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
public function getIsWebmaster()
return $this->can((new Webmaster)->name, $this->identity);
*
public function getLoginPriority()
return [
'id' => \rhosocial\user\User::$idRegex,
'username' => \rhosocial\user\User::$usernameRegex,
];
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: