for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace App\User;
use Cycle\ORM\Select;
use Yiisoft\Auth\IdentityInterface;
use Yiisoft\Auth\IdentityRepositoryInterface;
use Yiisoft\Data\Reader\DataReaderInterface;
use Yiisoft\Yii\Cycle\Data\Reader\EntityReader;
class UserRepository extends Select\Repository implements IdentityRepositoryInterface
{
public function findAll(array $scope = [], array $orderBy = []): DataReaderInterface
return new EntityReader($this->select()->where($scope)->orderBy($orderBy));
}
private function findIdentityBy(string $field, string $value): ?IdentityInterface
return $this->findOne([$field => $value]);
/**
* @param string $id
*
* @return IdentityInterface|User|null
*/
public function findIdentity(string $id): ?IdentityInterface
return $this->findByPK($id);
public function findIdentityByToken(string $token, string $type = null): ?IdentityInterface
$type
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function findIdentityByToken(string $token, /** @scrutinizer ignore-unused */ string $type = null): ?IdentityInterface
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return $this->findIdentityBy('token', $token);
public function findByLogin(string $login): ?IdentityInterface
return $this->findIdentityBy('login', $login);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.