From 97c1569e64eb87ae825043d12f2782e405f0e603 Mon Sep 17 00:00:00 2001 From: brutal-factories <143793262+brutal-factories@users.noreply.github.com> Date: Mon, 23 Feb 2026 13:39:13 +0100 Subject: [PATCH] chore(PersistentRelatedEntitiesCollection): add return type hints Added return type hints to methods inherited from interfaces/parents, to fix deprecation notices and warnings --- .../PersistentRelatedEntitiesCollection.php | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Entity/Listener/PersistentRelatedEntitiesCollection.php b/Entity/Listener/PersistentRelatedEntitiesCollection.php index 1793e1b8..f9ed8211 100644 --- a/Entity/Listener/PersistentRelatedEntitiesCollection.php +++ b/Entity/Listener/PersistentRelatedEntitiesCollection.php @@ -36,7 +36,7 @@ public function __construct(ManagerRegistry $registry, Job $job) * * @return array The PHP array representation of this collection. */ - public function toArray() + public function toArray(): array { $this->initialize(); @@ -135,7 +135,7 @@ public function removeElement($element) * @param mixed $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { $this->initialize(); @@ -150,7 +150,7 @@ public function offsetExists($offset) * @param mixed $offset * @return mixed */ - public function offsetGet($offset) + public function offsetGet($offset): mixed { $this->initialize(); @@ -167,7 +167,7 @@ public function offsetGet($offset) * @param mixed $value * @return bool */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { throw new \LogicException('Adding new related entities is not supported after initial creation.'); } @@ -180,7 +180,7 @@ public function offsetSet($offset, $value) * @param mixed $offset * @return mixed */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { throw new \LogicException('unset() is not supported.'); } @@ -191,7 +191,7 @@ public function offsetUnset($offset) * @param mixed $key The key to check for. * @return boolean TRUE if the given key/index exists, FALSE otherwise. */ - public function containsKey($key) + public function containsKey($key): bool { $this->initialize(); @@ -208,7 +208,7 @@ public function containsKey($key) * @return boolean TRUE if the given element is contained in the collection, * FALSE otherwise. */ - public function contains($element) + public function contains($element): bool { $this->initialize(); @@ -227,7 +227,7 @@ public function contains($element) * @param Closure $p The predicate. * @return boolean TRUE if the predicate is TRUE for at least one element, FALSE otherwise. */ - public function exists(Closure $p) + public function exists(Closure $p): bool { $this->initialize(); @@ -248,7 +248,7 @@ public function exists(Closure $p) * @param mixed $element The element to search for. * @return mixed The key/index of the element or FALSE if the element was not found. */ - public function indexOf($element) + public function indexOf($element): mixed { $this->initialize(); @@ -261,7 +261,7 @@ public function indexOf($element) * @param mixed $key The key. * @return mixed The element or NULL, if no element exists for the given key. */ - public function get($key) + public function get($key): mixed { $this->initialize(); @@ -276,7 +276,7 @@ public function get($key) * * @return array */ - public function getKeys() + public function getKeys(): array { $this->initialize(); @@ -288,7 +288,7 @@ public function getKeys() * * @return array */ - public function getValues() + public function getValues(): array { $this->initialize(); @@ -302,7 +302,7 @@ public function getValues() * * @return integer The number of elements in the collection. */ - public function count() + public function count(): int { $this->initialize(); @@ -318,7 +318,7 @@ public function count() * @param mixed $key * @param mixed $value */ - public function set($key, $value) + public function set($key, $value): void { throw new \LogicException('set() is not supported.'); } @@ -329,7 +329,7 @@ public function set($key, $value) * @param mixed $value * @return boolean Always TRUE. */ - public function add($value) + public function add($value): bool { throw new \LogicException('Adding new entities is not supported after creation.'); } @@ -341,7 +341,7 @@ public function add($value) * * @return boolean TRUE if the collection is empty, FALSE otherwise. */ - public function isEmpty() + public function isEmpty(): bool { $this->initialize(); @@ -353,7 +353,7 @@ public function isEmpty() * * @return ArrayIterator */ - public function getIterator() + public function getIterator(): ArrayIterator { $this->initialize(); @@ -395,7 +395,7 @@ public function filter(Closure $p) * @param Closure $p The predicate. * @return boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise. */ - public function forAll(Closure $p) + public function forAll(Closure $p): bool { $this->initialize(); @@ -445,7 +445,7 @@ public function __toString() /** * Clears the collection. */ - public function clear() + public function clear(): void { throw new \LogicException('clear() is not supported.'); }