@@ -211,7 +211,7 @@ public function find(?string $className, $id): ?object
211211 }
212212 }
213213
214- public function findMany (?string $ className , array $ ids ): Collection
214+ public function findMany (?string $ className , array $ ids ): array
215215 {
216216 // when loading duplicate ID's the resulting response would be a collection of unique ids,
217217 // but having duplicates would also cause a lot of overhead as well as break translation loading,
@@ -343,7 +343,7 @@ public function createPhpcrQueryBuilder(): PhpcrQueryBuilder
343343 return new PhpcrQueryBuilder ($ qm ->getQOMFactory ());
344344 }
345345
346- public function getDocumentsByPhpcrQuery (QueryInterface $ query , ?string $ className = null , ?string $ primarySelector = null ): Collection
346+ public function getDocumentsByPhpcrQuery (QueryInterface $ query , ?string $ className = null , ?string $ primarySelector = null ): array
347347 {
348348 $ this ->errorIfClosed ();
349349
@@ -372,11 +372,9 @@ public function getDocumentsByPhpcrQuery(QueryInterface $query, ?string $classNa
372372 * for the default language and that is used to store. The field is
373373 * updated with the locale.
374374 *
375- * @param object $document the document to persist
376- *
377375 * @throws InvalidArgumentException if $document is not an object
378376 */
379- public function persist ($ document ): void
377+ public function persist (object $ document ): void
380378 {
381379 if (!is_object ($ document )) {
382380 throw new InvalidArgumentException ('Parameter $document needs to be an object, ' .gettype ($ document ).' given ' );
@@ -447,17 +445,9 @@ public function reorder(object $document, string $srcName, string $targetName, b
447445 * Be aware of the PHPCR tree structure: this removes all nodes with a path under
448446 * the path of this object, even if there are no Parent / Child mappings
449447 * that make the relationship explicit.
450- *
451- * @param object $document
452- *
453- * @throws InvalidArgumentException if $document is not an object
454448 */
455- public function remove ($ document ): void
449+ public function remove (object $ document ): void
456450 {
457- if (!is_object ($ document )) {
458- throw new InvalidArgumentException ('Parameter $document needs to be an object, ' .gettype ($ document ).' given ' );
459- }
460-
461451 $ this ->errorIfClosed ();
462452 $ this ->unitOfWork ->scheduleRemove ($ document );
463453 }
@@ -471,17 +461,9 @@ public function remove($document): void
471461 * removal of the object) will not be synchronized to the database.
472462 * Objects which previously referenced the detached object will continue to
473463 * reference it.
474- *
475- * @param object $document the object to detach
476- *
477- * @throws InvalidArgumentException if $document is not an object
478464 */
479- public function detach ($ document ): void
465+ public function detach (object $ document ): void
480466 {
481- if (!is_object ($ document )) {
482- throw new InvalidArgumentException ('Parameter $document needs to be an object, ' .gettype ($ document ).' given ' );
483- }
484-
485467 $ this ->errorIfClosed ();
486468 $ this ->unitOfWork ->detach ($ document );
487469 }
@@ -490,17 +472,9 @@ public function detach($document): void
490472 * {@inheritdoc}
491473 *
492474 * Refresh the given document by querying the PHPCR to get the current state.
493- *
494- * @param object $document
495- *
496- * @throws InvalidArgumentException if $document is not an object
497475 */
498- public function refresh ($ document ): void
476+ public function refresh (object $ document ): void
499477 {
500- if (!is_object ($ document )) {
501- throw new InvalidArgumentException ('Parameter $document needs to be an object, ' .gettype ($ document ).' given ' );
502- }
503-
504478 $ this ->errorIfClosed ();
505479 $ this ->unitOfWork ->refresh ($ document );
506480 }
@@ -594,19 +568,9 @@ public function findVersionByName(?string $className, string $id, string $versio
594568 * {@inheritdoc}
595569 *
596570 * Check if this repository contains the object
597- *
598- * @param object $document
599- *
600- * @return bool true if the repository contains the object, false otherwise
601- *
602- * @throws InvalidArgumentException if $document is not an object
603571 */
604- public function contains ($ document ): bool
572+ public function contains (object $ document ): bool
605573 {
606- if (!is_object ($ document )) {
607- throw new InvalidArgumentException ('Parameter $document needs to be an object, ' .gettype ($ document ).' given ' );
608- }
609-
610574 return $ this ->unitOfWork ->contains ($ document );
611575 }
612576
@@ -637,12 +601,8 @@ public function close(): void
637601 $ this ->closed = true ;
638602 }
639603
640- public function initializeObject ($ document ): void
604+ public function initializeObject (object $ document ): void
641605 {
642- if (!is_object ($ document )) {
643- throw new InvalidArgumentException ('Parameter $document needs to be an object, ' .gettype ($ document ).' given ' );
644- }
645-
646606 $ this ->unitOfWork ->initializeObject ($ document );
647607 }
648608
0 commit comments