@@ -30,10 +30,10 @@ public function __construct(
3030 }
3131
3232 /**
33- * @template CLASS FsAccessUpdate| FsCreation|FsDeletion|FsMove
34- * @template- param class-string<CLASS> $className
35- * @return list<CLASS>
36- * @throws \OCP\DB\Exception
33+ * @param class-string< FsCreation|FsDeletion|FsMove|FsAccessUpdate> $className
34+ * @param int $storageId
35+ * @param int $limit
36+ * @return list<FsCreation|FsDeletion|FsMove|FsAccessUpdate>
3737 * @throws \Exception
3838 */
3939 public function findByStorageId (string $ className , int $ storageId , int $ limit = 0 ): array {
@@ -51,9 +51,8 @@ public function findByStorageId(string $className, int $storageId, int $limit =
5151 }
5252
5353 /**
54- * @template CLASS FsAccessUpdate|FsCreation|FsDeletion|FsMove
55- * @template-param class-string<CLASS> $className
56- * @return list<CLASS>
54+ * @param class-string<FsCreation|FsDeletion|FsMove|FsAccessUpdate> $className
55+ * @return list<FsCreation|FsDeletion|FsMove|FsAccessUpdate>
5756 * @throws \OCP\DB\Exception
5857 * @throws \Exception
5958 */
@@ -71,11 +70,9 @@ public function find(string $className, int $limit = 0): array {
7170 }
7271
7372 /**
74- * @template CLASS FsAccessUpdate|FsCreation|FsDeletion|FsMove
75- * @template-param class-string<CLASS> $className
76- * @param string $className
73+ * @param class-string<FsCreation|FsDeletion|FsMove|FsAccessUpdate> $className
7774 * @param int $nodeId
78- * @return Entity
75+ * @return FsCreation|FsDeletion|FsMove|FsAccessUpdate
7976 * @throws DoesNotExistException
8077 * @throws Exception
8178 * @throws MultipleObjectsReturnedException
@@ -92,9 +89,7 @@ public function findByNodeId(string $className, int $nodeId): Entity {
9289 }
9390
9491 /**
95- * @template CLASS FsAccessUpdate|FsCreation|FsDeletion|FsMove
96- * @template-param class-string<CLASS> $className
97- * @param string $className
92+ * @param class-string<FsCreation|FsDeletion|FsMove|FsAccessUpdate> $className
9893 * @param int $storageId
9994 * @return int
10095 * @throws Exception
@@ -115,9 +110,7 @@ public function countByStorageId(string $className, int $storageId): int {
115110 }
116111
117112 /**
118- * @template CLASS FsAccessUpdate|FsCreation|FsDeletion|FsMove
119- * @template-param class-string<CLASS> $className
120- * @param string $className
113+ * @param class-string<FsCreation|FsDeletion|FsMove|FsAccessUpdate> $className
121114 * @return int
122115 * @throws Exception
123116 */
@@ -136,12 +129,10 @@ public function count(string $className): int {
136129 }
137130
138131 /**
139- * @template CLASS FsAccessUpdate|FsCreation|FsDeletion|FsMove
140- * @template-param class-string<CLASS> $className
141- * @param string $className
132+ * @param class-string<FsCreation|FsDeletion|FsMove|FsAccessUpdate> $className
142133 * @param int $storageId
143134 * @param int $rootId
144- * @return FsAccessUpdate
135+ * @return FsCreation|FsDeletion|FsMove| FsAccessUpdate
145136 * @throws DoesNotExistException
146137 * @throws Exception
147138 * @throws MultipleObjectsReturnedException
@@ -161,7 +152,7 @@ public function findByStorageIdAndRootId(string $className, int $storageId, int
161152 /**
162153 * @param int $storageId
163154 * @param int $rootId
164- * @return FsAccessUpdate
155+ * @return FsCreation|FsDeletion|FsMove| FsAccessUpdate
165156 * @throws Exception
166157 * @throws MultipleObjectsReturnedException
167158 */
@@ -184,34 +175,34 @@ public function insertAccessUpdate(int $storageId, int $rootId): Entity {
184175 /**
185176 * @param int $storageId
186177 * @param int $rootId
187- * @return FsAccessUpdate
178+ * @return FsCreation|FsDeletion|FsMove| FsAccessUpdate
188179 * @throws Exception
189180 * @throws MultipleObjectsReturnedException
190181 */
191182 public function insertCreation (int $ storageId , int $ rootId ): Entity {
192183 try {
193- $ accessUpdate = $ this ->findByStorageIdAndRootId (FsCreation::class, $ storageId , $ rootId );
184+ $ creation = $ this ->findByStorageIdAndRootId (FsCreation::class, $ storageId , $ rootId );
194185 } catch (DoesNotExistException $ e ) {
195- $ accessUpdate = new FsCreation ();
196- $ accessUpdate ->setStorageId ($ storageId );
197- $ accessUpdate ->setRootId ($ rootId );
198- $ this ->insert ($ accessUpdate );
186+ $ creation = new FsCreation ();
187+ $ creation ->setStorageId ($ storageId );
188+ $ creation ->setRootId ($ rootId );
189+ $ this ->insert ($ creation );
199190 $ arguments = [ 'type ' => FsCreation::class, 'storage_id ' => $ storageId ];
200191 if (!$ this ->jobList ->has (ProcessFsActionsJob::class, $ arguments )) {
201192 $ this ->jobList ->add (ProcessFsActionsJob::class, $ arguments );
202193 }
203194 }
204- return $ accessUpdate ;
195+ return $ creation ;
205196 }
206197
207198
208199 /**
209200 * @param int $storageId
210201 * @param int $nodeId
211- * @return FsAccessUpdate
202+ * @return FsCreation|FsDeletion|FsMove| FsAccessUpdate
212203 * @throws Exception|MultipleObjectsReturnedException
213204 */
214- public function insertDeletion (int $ storageId , int $ nodeId ): Entity {
205+ public function insertDeletion (int $ storageId , int $ nodeId ): FsCreation | FsDeletion | FsMove | FsAccessUpdate {
215206 try {
216207 $ deletion = $ this ->findByNodeId (FsDeletion::class, $ nodeId );
217208 } catch (DoesNotExistException $ e ) {
@@ -230,9 +221,9 @@ public function insertDeletion(int $storageId, int $nodeId): Entity {
230221 /**
231222 * @param int $nodeId
232223 * @param string $owner
233- * @param array $addedUsers
234- * @param array $targetUsers
235- * @return FsAccessUpdate
224+ * @param list<string> $addedUsers
225+ * @param list<string> $targetUsers
226+ * @return FsCreation|FsDeletion|FsMove| FsAccessUpdate
236227 * @throws Exception|MultipleObjectsReturnedException
237228 */
238229 public function insertMove (int $ nodeId , string $ owner , array $ addedUsers , array $ targetUsers ): Entity {
@@ -254,13 +245,14 @@ public function insertMove(int $nodeId, string $owner, array $addedUsers, array
254245 }
255246
256247 /**
257- * @param Entity $entity
258- * @return FsAccessUpdate
248+ * @param FsCreation|FsDeletion|FsMove|FsAccessUpdate $entity
249+ * @return FsCreation|FsDeletion|FsMove| FsAccessUpdate
259250 * @throws Exception
260251 */
261252 public function insert (Entity $ entity ): Entity {
262253 // get updated fields to save, fields have to be set using a setter to
263254 // be saved
255+ /** @var array<string, mixed> $properties */
264256 $ properties = $ entity ->getUpdatedFields ();
265257
266258 $ qb = $ this ->db ->getQueryBuilder ();
@@ -278,6 +270,7 @@ public function insert(Entity $entity): Entity {
278270
279271 $ qb ->executeStatement ();
280272
273+ /** @psalm-suppress DocblockTypeContradiction */
281274 if ($ entity ->id === null ) {
282275 // When autoincrement is used id is always an int
283276 $ entity ->setId ($ qb ->getLastInsertId ());
@@ -290,9 +283,9 @@ public function insert(Entity $entity): Entity {
290283 * Returns an db result and throws exceptions when there are more or less
291284 * results
292285 *
293- * @param string $className
286+ * @param class- string<FsCreation|FsDeletion|FsMove|FsAccessUpdate> $className
294287 * @param IQueryBuilder $query
295- * @return Entity the entity
288+ * @return FsCreation|FsDeletion|FsMove|FsAccessUpdate the entity
296289 * @throws DoesNotExistException if the item does not exist
297290 * @throws Exception
298291 * @throws MultipleObjectsReturnedException if more than one item exist
@@ -304,9 +297,9 @@ protected function findItem(string $className, IQueryBuilder $query): Entity {
304297 /**
305298 * Runs a sql query and returns an array of items
306299 *
307- * @param string $className
300+ * @param class- string<FsCreation|FsDeletion|FsMove|FsAccessUpdate> $className
308301 * @param IQueryBuilder $query
309- * @return list<Entity > all fetched entities
302+ * @return list<FsCreation|FsDeletion|FsMove|FsAccessUpdate > all fetched entities
310303 */
311304 protected function findItems (string $ className , IQueryBuilder $ query ): array {
312305 $ result = $ query ->executeQuery ();
@@ -321,6 +314,9 @@ protected function findItems(string $className, IQueryBuilder $query): array {
321314 }
322315 }
323316
317+ /**
318+ * @param class-string<FsCreation|FsDeletion|FsMove|FsAccessUpdate> $className
319+ */
324320 protected function mapRowToItem (string $ className , array $ row ): Entity {
325321 unset($ row ['DOCTRINE_ROWNUM ' ]); // remove doctrine/dbal helper column
326322 return \call_user_func ($ className . '::fromRow ' , $ row );
@@ -329,8 +325,8 @@ protected function mapRowToItem(string $className, array $row): Entity {
329325 /**
330326 * Deletes an item from the table
331327 *
332- * @param Entity $entity the entity that should be deleted
333- * @return Entity the deleted entity
328+ * @param FsCreation|FsDeletion|FsMove|FsAccessUpdate $entity the entity that should be deleted
329+ * @return FsCreation|FsDeletion|FsMove|FsAccessUpdate the deleted entity
334330 * @throws Exception
335331 */
336332 public function delete (Entity $ entity ): Entity {
0 commit comments