Skip to content

Commit 38eee5e

Browse files
committed
Fix Psalm errors
1 parent 2dce258 commit 38eee5e

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

src/PseudoTypes/NonEmptyArray.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ public function underlyingType(): Type
3535
*/
3636
public function __toString(): string
3737
{
38-
if ($this->keyType) {
39-
return 'non-empty-array<' . $this->keyType . ',' . $this->valueType . '>';
40-
}
41-
4238
if ($this->valueType === null) {
4339
return 'non-empty-array';
4440
}
4541

42+
if ($this->keyType) {
43+
return 'non-empty-array<' . $this->keyType . ',' . $this->valueType . '>';
44+
}
45+
4646
return 'non-empty-array<' . $this->valueType . '>';
4747
}
4848
}

src/Types/AbstractList.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ public function getValueType(): Type
7676
*/
7777
public function __toString(): string
7878
{
79-
if ($this->keyType) {
80-
return 'array<' . $this->keyType . ',' . $this->valueType . '>';
81-
}
82-
8379
if ($this->valueType === null) {
8480
return 'array';
8581
}
8682

83+
if ($this->keyType) {
84+
return 'array<' . $this->keyType . ',' . $this->valueType . '>';
85+
}
86+
8787
if ($this->valueType instanceof Compound) {
8888
return '(' . $this->valueType . ')[]';
8989
}

src/Types/Collection.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,13 @@ public function __toString(): string
5959
{
6060
$objectType = (string) ($this->fqsen ?? 'object');
6161

62+
/** @var string */
63+
$valueType = $this->valueType;
64+
6265
if ($this->keyType === null) {
63-
return $objectType . '<' . $this->valueType . '>';
66+
return $objectType . '<' . $valueType . '>';
6467
}
6568

66-
return $objectType . '<' . $this->keyType . ',' . $this->valueType . '>';
69+
return $objectType . '<' . $this->keyType . ',' . $valueType . '>';
6770
}
6871
}

src/Types/Iterable_.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ final class Iterable_ extends AbstractList
2525
*/
2626
public function __toString(): string
2727
{
28-
if ($this->keyType) {
29-
return 'iterable<' . $this->keyType . ',' . $this->valueType . '>';
30-
}
31-
3228
if ($this->valueType === null) {
3329
return 'iterable';
3430
}
3531

32+
if ($this->keyType) {
33+
return 'iterable<' . $this->keyType . ',' . $this->valueType . '>';
34+
}
35+
3636
return 'iterable<' . $this->valueType . '>';
3737
}
3838
}

0 commit comments

Comments
 (0)