Skip to content

Commit 993a278

Browse files
committed
Clean up Psalm-specific annotations
1 parent d1d6c79 commit 993a278

1 file changed

Lines changed: 17 additions & 38 deletions

File tree

src/ObjectStorage.php

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,23 @@ final class ObjectStorage implements Countable, IteratorAggregate, ArrayAccess
3030
/**
3131
* The objects contained in the storage, as a map of object id to object.
3232
*
33-
* @psalm-var array<int, K>
34-
* @var array<int, object>
33+
* @var array<int, K>
3534
*/
3635
private array $objects = [];
3736

3837
/**
3938
* The data in the storage, as a map of object id to datum.
4039
*
41-
* @psalm-var array<int, V>
42-
* @var array<int, mixed>
40+
* @var array<int, V>
4341
*/
4442
private array $data = [];
4543

4644
/**
4745
* Returns whether this storage contains the given object.
4846
*
49-
* @param object $object The object to test.
47+
* @param K $object The object to test.
5048
*
5149
* @return bool True if this storage contains the object, false otherwise.
52-
*
53-
* @psalm-param K $object
5450
*/
5551
public function has(object $object): bool
5652
{
@@ -64,12 +60,9 @@ public function has(object $object): bool
6460
*
6561
* If the given object is not in the storage, or has no associated data, NULL is returned.
6662
*
67-
* @param object $object The object.
68-
*
69-
* @return mixed The stored data.
63+
* @param K $object The object.
7064
*
71-
* @psalm-param K $object
72-
* @psalm-return V
65+
* @return V The stored data.
7366
*/
7467
public function get(object $object): mixed
7568
{
@@ -81,11 +74,8 @@ public function get(object $object): mixed
8174
/**
8275
* Stores an object with associated data.
8376
*
84-
* @param object $object The object.
85-
* @param mixed $data The data to store.
86-
*
87-
* @psalm-param K $object
88-
* @psalm-param V $data
77+
* @param K $object The object.
78+
* @param V $data The data to store.
8979
*/
9080
public function set(object $object, mixed $data = null): void
9181
{
@@ -100,9 +90,7 @@ public function set(object $object, mixed $data = null): void
10090
*
10191
* If this storage does not contain the given object, this method does nothing.
10292
*
103-
* @param object $object The object to remove.
104-
*
105-
* @psalm-param K $object
93+
* @param K $object The object to remove.
10694
*/
10795
public function remove(object $object): void
10896
{
@@ -125,9 +113,7 @@ public function count(): int
125113
/**
126114
* Returns the objects contained in this storage.
127115
*
128-
* @return object[]
129-
*
130-
* @psalm-return V[]
116+
* @return V[]
131117
*/
132118
public function getObjects(): array
133119
{
@@ -139,7 +125,7 @@ public function getObjects(): array
139125
*
140126
* This method is part of the IteratorAggregate interface.
141127
*
142-
* @psalm-return Traversable<K, V>
128+
* @return Traversable<K, V>
143129
*/
144130
public function getIterator(): Traversable
145131
{
@@ -149,12 +135,11 @@ public function getIterator(): Traversable
149135
}
150136

151137
/**
152-
* @param object $object
138+
* @param K $object
153139
*
154-
* @throws UnexpectedValueException If the object cannot be found.
140+
* @return V
155141
*
156-
* @psalm-param K $object
157-
* @psalm-return V
142+
* @throws UnexpectedValueException If the object cannot be found.
158143
*/
159144
public function offsetGet(mixed $object): mixed
160145
{
@@ -168,10 +153,8 @@ public function offsetGet(mixed $object): mixed
168153
}
169154

170155
/**
171-
* @param object $object
172-
*
173-
* @psalm-param K $object
174-
* @psalm-param V $value
156+
* @param K $object
157+
* @param V $value
175158
*/
176159
public function offsetSet(mixed $object, mixed $value): void
177160
{
@@ -182,9 +165,7 @@ public function offsetSet(mixed $object, mixed $value): void
182165
}
183166

184167
/**
185-
* @param object $object
186-
*
187-
* @psalm-param K $object
168+
* @param K $object
188169
*/
189170
public function offsetUnset(mixed $object): void
190171
{
@@ -195,9 +176,7 @@ public function offsetUnset(mixed $object): void
195176
}
196177

197178
/**
198-
* @param object $object
199-
*
200-
* @psalm-param K $object
179+
* @param K $object
201180
*/
202181
public function offsetExists(mixed $object): bool
203182
{

0 commit comments

Comments
 (0)