Skip to content

Commit 0fcd661

Browse files
committed
Fix more generic types
Signed-off-by: Alexander M. Turek <[email protected]>
1 parent 823f9f4 commit 0fcd661

File tree

6 files changed

+25
-23
lines changed

6 files changed

+25
-23
lines changed

Button.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(FormConfigInterface $config)
4949
/**
5050
* Unsupported method.
5151
*
52-
* @param mixed $offset
52+
* @param string $offset
5353
*
5454
* @return bool
5555
*/
@@ -64,7 +64,7 @@ public function offsetExists($offset)
6464
*
6565
* This method should not be invoked.
6666
*
67-
* @param mixed $offset
67+
* @param string $offset
6868
*
6969
* @return FormInterface
7070
*
@@ -81,8 +81,8 @@ public function offsetGet($offset)
8181
*
8282
* This method should not be invoked.
8383
*
84-
* @param mixed $offset
85-
* @param mixed $value
84+
* @param string $offset
85+
* @param FormInterface $value
8686
*
8787
* @return void
8888
*
@@ -99,7 +99,7 @@ public function offsetSet($offset, $value)
9999
*
100100
* This method should not be invoked.
101101
*
102-
* @param mixed $offset
102+
* @param string $offset
103103
*
104104
* @return void
105105
*

Extension/Validator/ViolationMapper/ViolationPath.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717

1818
/**
1919
* @author Bernhard Schussek <[email protected]>
20+
*
21+
* @implements \IteratorAggregate<int, string>
2022
*/
2123
class ViolationPath implements \IteratorAggregate, PropertyPathInterface
2224
{
2325
/**
24-
* @var string[]
26+
* @var list<string>
2527
*/
2628
private $elements = [];
2729

FormBuilderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* @author Bernhard Schussek <[email protected]>
1616
*
17-
* @extends \Traversable<string, self>
17+
* @extends \Traversable<string, FormBuilderInterface>
1818
*/
1919
interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuilderInterface
2020
{

FormErrorIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class FormErrorIterator implements \RecursiveIterator, \SeekableIterator, \Array
4444
private $errors;
4545

4646
/**
47-
* @param array<int, FormError|self> $errors
47+
* @param list<FormError|self> $errors
4848
*
4949
* @throws InvalidArgumentException If the errors are invalid
5050
*/

Util/OrderedHashMap.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
8282
/**
8383
* The keys of the map in the order in which they were inserted or changed.
8484
*
85-
* @var array
85+
* @var list<TKey>
8686
*/
8787
private $orderedKeys = [];
8888

8989
/**
9090
* References to the cursors of all open iterators.
9191
*
92-
* @var array
92+
* @var array<int, int>
9393
*/
9494
private $managedCursors = [];
9595

@@ -116,7 +116,7 @@ public function offsetExists($key)
116116
/**
117117
* {@inheritdoc}
118118
*
119-
* @return mixed
119+
* @return TValue
120120
*/
121121
#[\ReturnTypeWillChange]
122122
public function offsetGet($key)

Util/OrderedHashMapIterator.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,54 +18,54 @@
1818
*
1919
* @internal
2020
*
21-
* @template TKey
22-
* @template TValue
21+
* @template-covariant TKey of array-key
22+
* @template-covariant TValue
2323
*
2424
* @implements \Iterator<TKey, TValue>
2525
*/
2626
class OrderedHashMapIterator implements \Iterator
2727
{
2828
/**
29-
* @var array
29+
* @var array<TKey, TValue>
3030
*/
3131
private $elements;
3232

3333
/**
34-
* @var array
34+
* @var list<TKey>
3535
*/
3636
private $orderedKeys;
3737

3838
/**
3939
* @var int
4040
*/
41-
private $cursor;
41+
private $cursor = 0;
4242

4343
/**
4444
* @var int
4545
*/
4646
private $cursorId;
4747

4848
/**
49-
* @var array
49+
* @var array<int, int>
5050
*/
5151
private $managedCursors;
5252

5353
/**
54-
* @var string|int|null
54+
* @var TKey|null
5555
*/
5656
private $key;
5757

5858
/**
59-
* @var mixed
59+
* @var TValue|null
6060
*/
6161
private $current;
6262

6363
/**
6464
* @param array<TKey, TValue> $elements The elements of the map, indexed by their
6565
* keys
66-
* @param array $orderedKeys The keys of the map in the order in which
66+
* @param list<TKey> $orderedKeys The keys of the map in the order in which
6767
* they should be iterated
68-
* @param array $managedCursors An array from which to reference the
68+
* @param array<int, int> $managedCursors An array from which to reference the
6969
* iterator's cursor as long as it is alive.
7070
* This array is managed by the corresponding
7171
* {@link OrderedHashMap} instance to support
@@ -105,7 +105,7 @@ public function __destruct()
105105
/**
106106
* {@inheritdoc}
107107
*
108-
* @return mixed
108+
* @return TValue|null
109109
*/
110110
#[\ReturnTypeWillChange]
111111
public function current()
@@ -132,7 +132,7 @@ public function next(): void
132132
/**
133133
* {@inheritdoc}
134134
*
135-
* @return mixed
135+
* @return TKey|null
136136
*/
137137
#[\ReturnTypeWillChange]
138138
public function key()

0 commit comments

Comments
 (0)