chore: Fix new psalm errors

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2022-12-30 14:08:31 +01:00
parent 8ee7b1f1e8
commit c739d543c2
15 changed files with 26 additions and 51 deletions

View File

@@ -28,6 +28,7 @@ use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
/** @template-extends DeckMapper<Acl> */
class AclMapper extends DeckMapper implements IPermissionMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'deck_board_acl', Acl::class);

View File

@@ -35,6 +35,7 @@ use OCP\IGroupManager;
use OCP\IUserManager;
use PDO;
/** @template-extends QBMapper<Assignment> */
class AssignmentMapper extends QBMapper implements IPermissionMapper {
/** @var CardMapper */

View File

@@ -31,6 +31,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\IUserManager;
/** @template-extends DeckMapper<Attachment> */
class AttachmentMapper extends DeckMapper implements IPermissionMapper {
private $cardMapper;
private $userManager;

View File

@@ -33,6 +33,7 @@ use OCP\IUserManager;
use OCP\IGroupManager;
use Psr\Log\LoggerInterface;
/** @template-extends QBMapper<Board> */
class BoardMapper extends QBMapper implements IPermissionMapper {
private $labelMapper;
private $aclMapper;

View File

@@ -38,6 +38,7 @@ use OCP\IUser;
use OCP\IUserManager;
use OCP\Notification\IManager;
/** @template-extends QBMapper<Card> */
class CardMapper extends QBMapper implements IPermissionMapper {
/** @var LabelMapper */

View File

@@ -23,15 +23,15 @@
namespace OCA\Deck\Db;
use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\QBMapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
/**
* Class DeckMapper
*
* @package OCA\Deck\Db
* @template T of Entity
* @template-extends QBMapper<T>
*/
class DeckMapper extends QBMapper {
abstract class DeckMapper extends QBMapper {
/**
* @param $id

View File

@@ -29,6 +29,7 @@ use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
/** @template-extends DeckMapper<Label> */
class LabelMapper extends DeckMapper implements IPermissionMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'deck_labels', Label::class);
@@ -51,11 +52,6 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
return $this->findEntities($qb);
}
/**
* @param Entity $entity
* @return Entity
* @throws \OCP\DB\Exception
*/
public function delete(Entity $entity): Entity {
// delete assigned labels
$this->deleteLabelAssignments($entity->getId());
@@ -105,23 +101,12 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
return $this->findEntities($qb);
}
/**
* @param Entity $entity
* @return Entity
* @throws \OCP\DB\Exception
*/
public function insert(Entity $entity): Entity {
$entity->setLastModified(time());
return parent::insert($entity);
}
/**
* @param Entity $entity
* @param bool $updateModified
* @return Entity
* @throws \OCP\DB\Exception
*/
public function update(Entity $entity, $updateModified = true): Entity {
public function update(Entity $entity, bool $updateModified = true): Entity {
if ($updateModified) {
$entity->setLastModified(time());
}

View File

@@ -29,6 +29,7 @@ use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
/** @template-extends DeckMapper<Stack> */
class StackMapper extends DeckMapper implements IPermissionMapper {
private $cardMapper;
@@ -112,11 +113,6 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
return $this->findEntities($qb);
}
/**
* @param Entity $entity
* @return Entity
* @throws \OCP\DB\Exception
*/
public function delete(Entity $entity): Entity {
// delete cards on stack
$this->cardMapper->deleteByStack($entity->getId());