Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing param type declarations #332

Merged
merged 2 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ You can find a list of major changes to public API below.
| forAll(Closure $p) | forAll(Closure $p): bool |
| map(Closure $func) | map(Closure $func): self |
| partition(Closure $p) | partition(Closure $p): array |
| indexOf(mixed $element) | indexOf(mixed $element): int|string|false |
| indexOf($element) | indexOf(mixed $element): int|string|false |
| slice($offset, $length = null) | slice(int $offset, ?int $length = null): array |
| count() | count(): int |
| getIterator() | getIterator(): \Traversable |
| offsetSet($offset, $value) | offsetSet($offset, $value): void |
| offsetUnset($offset) | offsetUnset($offset): void |
| offsetExists($offset) | offsetExists($offset): bool |
| offsetSet($offset, $value) | offsetSet(mixed $offset, mixed $value): void |
| offsetUnset($offset) | offsetUnset(mixed $offset): void |
| offsetExists($offset) | offsetExists(mixed $offset): bool |

### Doctrine\Common\Collections\AbstractLazyCollection

Expand Down
18 changes: 6 additions & 12 deletions lib/Doctrine/Common/Collections/AbstractLazyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function clear(): void
*
* @template TMaybeContained
*/
public function contains($element): bool
public function contains(mixed $element): bool
{
$this->initialize();

Expand All @@ -73,20 +73,14 @@ public function remove(string|int $key): mixed
return $this->collection->remove($key);
}

/**
* {@inheritDoc}
*/
public function removeElement($element): bool
public function removeElement(mixed $element): bool
{
$this->initialize();

return $this->collection->removeElement($element);
}

/**
* {@inheritDoc}
*/
public function containsKey($key): bool
public function containsKey(string|int $key): bool
{
$this->initialize();

Expand Down Expand Up @@ -285,7 +279,7 @@ public function offsetExists($offset): bool
}

/** @param TKey $offset */
public function offsetGet($offset): mixed
public function offsetGet(mixed $offset): mixed
{
$this->initialize();

Expand All @@ -296,14 +290,14 @@ public function offsetGet($offset): mixed
* @param TKey|null $offset
* @param T $value
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
$this->initialize();
$this->collection->offsetSet($offset, $value);
}

/** @param TKey $offset */
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
$this->initialize();
$this->collection->offsetUnset($offset);
Expand Down
18 changes: 6 additions & 12 deletions lib/Doctrine/Common/Collections/ArrayCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ public function remove(string|int $key): mixed
return $removed;
}

/**
* {@inheritDoc}
*/
public function removeElement($element): bool
public function removeElement(mixed $element): bool
{
$key = array_search($element, $this->elements, true);

Expand Down Expand Up @@ -161,7 +158,7 @@ public function offsetExists($offset): bool
*
* @param TKey $offset
*/
public function offsetGet($offset): mixed
public function offsetGet(mixed $offset): mixed
{
return $this->get($offset);
}
Expand All @@ -172,7 +169,7 @@ public function offsetGet($offset): mixed
* @param TKey|null $offset
* @param T $value
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if ($offset === null) {
$this->add($value);
Expand All @@ -188,15 +185,12 @@ public function offsetSet($offset, $value): void
*
* @param TKey $offset
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
$this->remove($offset);
}

/**
* {@inheritDoc}
*/
public function containsKey($key): bool
public function containsKey(string|int $key): bool
{
return isset($this->elements[$key]) || array_key_exists($key, $this->elements);
}
Expand All @@ -206,7 +200,7 @@ public function containsKey($key): bool
*
* @template TMaybeContained
*/
public function contains($element): bool
public function contains(mixed $element): bool
{
return in_array($element, $this->elements, true);
}
Expand Down