Merge pull request #27121 from nextcloud/backport/27117/stable21

[stable21] Add DB exception '@throws' tag to QBMapper PHPDoc
This commit is contained in:
kesselb 2021-05-26 20:35:19 +02:00 committed by GitHub
commit e8f6d288ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 7 deletions

View File

@ -86,10 +86,12 @@ abstract class QBMapper {
/** /**
* Deletes an entity from the table * Deletes an entity from the table
*
* @param Entity $entity the entity that should be deleted * @param Entity $entity the entity that should be deleted
* @psalm-param T $entity the entity that should be deleted * @psalm-param T $entity the entity that should be deleted
* @return Entity the deleted entity * @return Entity the deleted entity
* @psalm-return T the deleted entity * @psalm-return T the deleted entity
* @throws Exception
* @since 14.0.0 * @since 14.0.0
*/ */
public function delete(Entity $entity): Entity { public function delete(Entity $entity): Entity {
@ -108,10 +110,12 @@ abstract class QBMapper {
/** /**
* Creates a new entry in the db from an entity * Creates a new entry in the db from an entity
*
* @param Entity $entity the entity that should be created * @param Entity $entity the entity that should be created
* @psalm-param T $entity the entity that should be created * @psalm-param T $entity the entity that should be created
* @return Entity the saved entity with the set id * @return Entity the saved entity with the set id
* @psalm-return T the saved entity with the set id * @psalm-return T the saved entity with the set id
* @throws Exception
* @since 14.0.0 * @since 14.0.0
*/ */
public function insert(Entity $entity): Entity { public function insert(Entity $entity): Entity {
@ -151,6 +155,7 @@ abstract class QBMapper {
* @psalm-param T $entity the entity that should be created/updated * @psalm-param T $entity the entity that should be created/updated
* @return Entity the saved entity with the (new) id * @return Entity the saved entity with the (new) id
* @psalm-return T the saved entity with the (new) id * @psalm-return T the saved entity with the (new) id
* @throws Exception
* @throws \InvalidArgumentException if entity has no id * @throws \InvalidArgumentException if entity has no id
* @since 15.0.0 * @since 15.0.0
*/ */
@ -167,11 +172,13 @@ abstract class QBMapper {
/** /**
* Updates an entry in the db from an entity * Updates an entry in the db from an entity
* @throws \InvalidArgumentException if entity has no id *
* @param Entity $entity the entity that should be created * @param Entity $entity the entity that should be created
* @psalm-param T $entity the entity that should be created * @psalm-param T $entity the entity that should be created
* @return Entity the saved entity with the set id * @return Entity the saved entity with the set id
* @psalm-return T the saved entity with the set id * @psalm-return T the saved entity with the set id
* @throws Exception
* @throws \InvalidArgumentException if entity has no id
* @since 14.0.0 * @since 14.0.0
*/ */
public function update(Entity $entity): Entity { public function update(Entity $entity): Entity {
@ -253,12 +260,13 @@ abstract class QBMapper {
* Returns an db result and throws exceptions when there are more or less * Returns an db result and throws exceptions when there are more or less
* results * results
* *
* @param IQueryBuilder $query
* @return array the result as row
* @throws Exception
* @throws MultipleObjectsReturnedException if more than one item exist
* @throws DoesNotExistException if the item does not exist
* @see findEntity * @see findEntity
* *
* @param IQueryBuilder $query
* @throws DoesNotExistException if the item does not exist
* @throws MultipleObjectsReturnedException if more than one item exist
* @return array the result as row
* @since 14.0.0 * @since 14.0.0
*/ */
protected function findOneQuery(IQueryBuilder $query): array { protected function findOneQuery(IQueryBuilder $query): array {
@ -317,6 +325,7 @@ abstract class QBMapper {
* @param IQueryBuilder $query * @param IQueryBuilder $query
* @return Entity[] all fetched entities * @return Entity[] all fetched entities
* @psalm-return T[] all fetched entities * @psalm-return T[] all fetched entities
* @throws Exception
* @since 14.0.0 * @since 14.0.0
*/ */
protected function findEntities(IQueryBuilder $query): array { protected function findEntities(IQueryBuilder $query): array {
@ -339,10 +348,11 @@ abstract class QBMapper {
* results * results
* *
* @param IQueryBuilder $query * @param IQueryBuilder $query
* @throws DoesNotExistException if the item does not exist
* @throws MultipleObjectsReturnedException if more than one item exist
* @return Entity the entity * @return Entity the entity
* @psalm-return T the entity * @psalm-return T the entity
* @throws Exception
* @throws MultipleObjectsReturnedException if more than one item exist
* @throws DoesNotExistException if the item does not exist
* @since 14.0.0 * @since 14.0.0
*/ */
protected function findEntity(IQueryBuilder $query): Entity { protected function findEntity(IQueryBuilder $query): Entity {