Skip to content

Commit c69909a

Browse files
committed
Change flip of assoc
1 parent d56dc08 commit c69909a

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/AssocArray.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,11 @@ public function toIterableValue(): IterableValue
226226
}
227227

228228
/**
229-
* @phpstan-return IterableValue<TValue, TKey>
229+
* @phpstan-return AssocValue<int|string, TKey>
230230
*/
231-
public function flip(): IterableValue
231+
public function flip(): AssocValue
232232
{
233-
return $this->toIterableValue()->flip();
233+
return new self(new Flip($this->items));
234234
}
235235

236236
/**

src/AssocValue.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ public function only(...$keys): AssocValue;
145145
public function withoutElement($value): AssocValue;
146146

147147
/**
148-
* @phpstan-return IterableValue<TValue, TKey>
148+
* @phpstan-return AssocValue<int|string, TKey>
149149
*/
150-
public function flip(): IterableValue;
150+
public function flip(): AssocValue;
151151

152152
/**
153153
* @param TKey $keyA

src/Associable/Flip.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
use function array_flip;
77

88
/**
9-
* @template TKey of int|string
9+
* @template TKey
1010
* @template TValue of int|string
11-
* @implements Associable<TKey,TValue>
11+
* @implements Associable<int|string,TValue>
1212
*/
1313
final class Flip implements Associable
1414
{
@@ -23,7 +23,7 @@ public function __construct(Associable $associable)
2323
$this->associable = $associable;
2424
}
2525

26-
/** @return array<TKey,TValue> */
26+
/** @return array<int|string,TValue> */
2727
public function toAssocArray(): array
2828
{
2929
return array_flip($this->associable->toAssocArray());

0 commit comments

Comments
 (0)