Skip to content

Commit 02e600d

Browse files
author
PedroTroller
committed
refactor: ad type to Dictionary ArrayAccess methods
1 parent f8c389e commit 02e600d

3 files changed

Lines changed: 12 additions & 21 deletions

File tree

src/Knp/DictionaryBundle/Dictionary/Simple.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,26 @@ public function getKeys(): array
3737
return array_keys($this->values);
3838
}
3939

40-
public function offsetExists($offset): bool
40+
public function offsetExists(mixed $offset): bool
4141
{
4242
return \array_key_exists($offset, $this->values);
4343
}
4444

45-
#[ReturnTypeWillChange]
46-
public function offsetGet($offset)
45+
public function offsetGet(mixed $offset): mixed
4746
{
4847
return $this->values[$offset];
4948
}
5049

51-
public function offsetSet($offset, $value): void
50+
public function offsetSet(mixed $offset, mixed $value): void
5251
{
5352
$this->values[$offset] = $value;
5453
}
5554

56-
public function offsetUnset($offset): void
55+
public function offsetUnset(mixed $offset): void
5756
{
5857
unset($this->values[$offset]);
5958
}
6059

61-
/**
62-
* @return Generator<mixed>
63-
*/
6460
public function getIterator(): Generator
6561
{
6662
yield from $this->values;

src/Knp/DictionaryBundle/Dictionary/Traceable.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,28 @@ public function getKeys(): array
4141
return $this->dictionary->getKeys();
4242
}
4343

44-
public function offsetExists($offset): bool
44+
public function offsetExists(mixed $offset): bool
4545
{
4646
$this->markAsUsed();
4747

4848
return $this->dictionary->offsetExists($offset);
4949
}
5050

51-
/**
52-
* @return
53-
*/
54-
#[ReturnTypeWillChange]
55-
public function offsetGet($offset)
51+
public function offsetGet(mixed $offset): mixed
5652
{
5753
$this->markAsUsed();
5854

5955
return $this->dictionary->offsetGet($offset);
6056
}
6157

62-
public function offsetSet($offset, $value): void
58+
public function offsetSet(mixed $offset, mixed $value): void
6359
{
6460
$this->dictionary->offsetSet($offset, $value);
6561

6662
$this->markAsUsed();
6763
}
6864

69-
public function offsetUnset($offset): void
65+
public function offsetUnset(mixed $offset): void
7066
{
7167
$this->dictionary->offsetUnset($offset);
7268

src/Knp/DictionaryBundle/Dictionary/Wrapper.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,22 @@ public function getKeys(): array
3636
return $this->wrapped->getKeys();
3737
}
3838

39-
public function offsetExists($offset): bool
39+
public function offsetExists(mixed $offset): bool
4040
{
4141
return $this->wrapped->offsetExists($offset);
4242
}
4343

44-
#[ReturnTypeWillChange]
45-
public function offsetGet($offset)
44+
public function offsetGet(mixed $offset): mixed
4645
{
4746
return $this->wrapped->offsetGet($offset);
4847
}
4948

50-
public function offsetSet($offset, $value): void
49+
public function offsetSet(mixed $offset, mixed $value): void
5150
{
5251
$this->wrapped->offsetSet($offset, $value);
5352
}
5453

55-
public function offsetUnset($offset): void
54+
public function offsetUnset(mixed $offset): void
5655
{
5756
$this->wrapped->offsetUnset($offset);
5857
}

0 commit comments

Comments
 (0)