Skip to content

Commit 878b6f2

Browse files
authored
Merge pull request #273 from mspirkov/improve-to-string-in-lists
Improve the conversion of lists to strings
2 parents 936bce1 + 492a638 commit 878b6f2

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

src/PseudoTypes/NonEmptyArray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __toString(): string
3939
}
4040

4141
if ($this->keyType) {
42-
return 'non-empty-array<' . $this->keyType . ',' . $this->valueType . '>';
42+
return 'non-empty-array<' . $this->keyType . ', ' . $this->valueType . '>';
4343
}
4444

4545
return 'non-empty-array<' . $this->valueType . '>';

src/Types/AbstractList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function __toString(): string
8181
}
8282

8383
if ($this->keyType) {
84-
return 'array<' . $this->keyType . ',' . $this->valueType . '>';
84+
return 'array<' . $this->keyType . ', ' . $this->valueType . '>';
8585
}
8686

8787
if ($this->valueType instanceof Compound) {

src/Types/Iterable_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __toString(): string
3030
}
3131

3232
if ($this->keyType) {
33-
return 'iterable<' . $this->keyType . ',' . $this->valueType . '>';
33+
return 'iterable<' . $this->keyType . ', ' . $this->valueType . '>';
3434
}
3535

3636
return 'iterable<' . $this->valueType . '>';

tests/unit/CollectionResolverTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ public function testResolvingArrayCollectionWithKey(): void
102102
{
103103
$fixture = new TypeResolver();
104104

105-
$resolvedType = $fixture->resolve('array<string,object|array>', new Context(''));
105+
$resolvedType = $fixture->resolve('array<string, object|array>', new Context(''));
106106

107107
$this->assertInstanceOf(Array_::class, $resolvedType);
108-
$this->assertSame('array<string,object|array>', (string) $resolvedType);
108+
$this->assertSame('array<string, object|array>', (string) $resolvedType);
109109

110110
$valueType = $resolvedType->getValueType();
111111

@@ -127,7 +127,7 @@ public function testResolvingArrayCollectionWithKeyAndWhitespace(): void
127127
$resolvedType = $fixture->resolve('array<string, object|array>', new Context(''));
128128

129129
$this->assertInstanceOf(Array_::class, $resolvedType);
130-
$this->assertSame('array<string,object|array>', (string) $resolvedType);
130+
$this->assertSame('array<string, object|array>', (string) $resolvedType);
131131

132132
$valueType = $resolvedType->getValueType();
133133

@@ -170,16 +170,16 @@ public function testResolvingCollectionOfCollection(): void
170170
public function testGoodArrayCollectionKey(): void
171171
{
172172
$fixture = new TypeResolver();
173-
$resolvedType = $fixture->resolve('array<array-key,string>', new Context(''));
173+
$resolvedType = $fixture->resolve('array<array-key, string>', new Context(''));
174174

175175
$this->assertInstanceOf(Array_::class, $resolvedType);
176-
$this->assertSame('array<array-key,string>', (string) $resolvedType);
176+
$this->assertSame('array<array-key, string>', (string) $resolvedType);
177177

178178
$fixture = new TypeResolver();
179-
$resolvedType = $fixture->resolve('array<class-string,string>', new Context(''));
179+
$resolvedType = $fixture->resolve('array<class-string, string>', new Context(''));
180180

181181
$this->assertInstanceOf(Array_::class, $resolvedType);
182-
$this->assertSame('array<class-string,string>', (string) $resolvedType);
182+
$this->assertSame('array<class-string, string>', (string) $resolvedType);
183183
}
184184

185185
public function testMissingStartCollection(): void
@@ -218,7 +218,7 @@ public function testResolvingCollectionAsArray(): void
218218
$resolvedType = $fixture->resolve('array<string,float>', new Context(''));
219219

220220
$this->assertInstanceOf(Array_::class, $resolvedType);
221-
$this->assertSame('array<string,float>', (string) $resolvedType);
221+
$this->assertSame('array<string, float>', (string) $resolvedType);
222222

223223
$valueType = $resolvedType->getValueType();
224224

tests/unit/PseudoTypes/NonEmptyArrayTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function provideToStringData(): array
5656
new Compound([new Integer(), new String_()]),
5757
new String_()
5858
),
59-
'non-empty-array<string,int|string>',
59+
'non-empty-array<string, int|string>',
6060
],
6161
];
6262
}

tests/unit/Types/ArrayTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function provideToStringData(): array
6464
'array of mixed' => [new Array_(new Mixed_()), 'mixed[]'],
6565
'array of single type' => [new Array_(new String_()), 'string[]'],
6666
'array of compound type' => [new Array_(new Compound([new Integer(), new String_()])), '(int|string)[]'],
67-
'array with key type' => [new Array_(new String_(), new Integer()), 'array<int,string>'],
67+
'array with key type' => [new Array_(new String_(), new Integer()), 'array<int, string>'],
6868
];
6969
}
7070
}

tests/unit/Types/IterableTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function provideToStringData(): array
3838
new Iterable_(new Compound([new Integer(), new String_()])),
3939
'iterable<int|string>',
4040
],
41-
'iterable with key type' => [new Iterable_(new String_(), new Integer()), 'iterable<int,string>'],
41+
'iterable with key type' => [new Iterable_(new String_(), new Integer()), 'iterable<int, string>'],
4242
];
4343
}
4444
}

0 commit comments

Comments
 (0)