MAPG-199 fix issues found by PHPStan

This commit is contained in:
bence committed 2020-07-05 23:18:56 +02:00
1 parent 39d691fd7f
commit af98d71924
34 files changed
+89 -68

No files matched your search

+8 -4
View File
@@ -45,9 +45,9 @@ class User extends Model implements IUser
}
}
public function setActive($active): void
public function setActive(bool $active): void
{
$this->active = (bool) $active;
$this->active = $active;
}
public function setGoogleSub(?string $googleSub): void
@@ -105,10 +105,10 @@ class User extends Model implements IUser
switch ($permission) {
case IUser::PERMISSION_NORMAL:
return true;
break;
case IUser::PERMISSION_ADMIN:
return $this->type === 'admin';
break;
default:
throw new \Exception('Permission does not exist: ' . $permission);
}
}
@@ -124,6 +124,10 @@ class User extends Model implements IUser
public function checkPassword(string $password): bool
{
if ($this->password === null) {
return false;
}
return password_verify($password, $this->password);
}
}
+2 -2
View File
@@ -8,7 +8,7 @@ use MapGuesser\PersistentData\Model\Model;
class PersistentDataManager
{
public function selectFromDb(Select $select, string $type, bool $withRelations = false): ?Model
public function selectFromDb(Select $select, string $type, bool $withRelations = false)
{
$select = $this->createSelect($select, $type, $withRelations);
@@ -37,7 +37,7 @@ class PersistentDataManager
}
}
public function selectFromDbById($id, string $type, bool $withRelations = false): ?Model
public function selectFromDbById($id, string $type, bool $withRelations = false)
{
$select = new Select(\Container::$dbConnection);
$select->whereId($id);