Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/PseudoTypes/NonEmptyArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __toString(): string
}

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

return 'non-empty-array<' . $this->valueType . '>';
Expand Down
2 changes: 1 addition & 1 deletion src/Types/AbstractList.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function __toString(): string
}

if ($this->keyType) {
return 'array<' . $this->keyType . ',' . $this->valueType . '>';
return 'array<' . $this->keyType . ', ' . $this->valueType . '>';
}

if ($this->valueType instanceof Compound) {
Expand Down
2 changes: 1 addition & 1 deletion src/Types/Iterable_.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __toString(): string
}

if ($this->keyType) {
return 'iterable<' . $this->keyType . ',' . $this->valueType . '>';
return 'iterable<' . $this->keyType . ', ' . $this->valueType . '>';
}

return 'iterable<' . $this->valueType . '>';
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/CollectionResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ public function testResolvingArrayCollectionWithKey(): void
{
$fixture = new TypeResolver();

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

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

$valueType = $resolvedType->getValueType();

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

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

$valueType = $resolvedType->getValueType();

Expand Down Expand Up @@ -170,16 +170,16 @@ public function testResolvingCollectionOfCollection(): void
public function testGoodArrayCollectionKey(): void
{
$fixture = new TypeResolver();
$resolvedType = $fixture->resolve('array<array-key,string>', new Context(''));
$resolvedType = $fixture->resolve('array<array-key, string>', new Context(''));

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

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

$this->assertInstanceOf(Array_::class, $resolvedType);
$this->assertSame('array<class-string,string>', (string) $resolvedType);
$this->assertSame('array<class-string, string>', (string) $resolvedType);
}

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

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

$valueType = $resolvedType->getValueType();

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/PseudoTypes/NonEmptyArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function provideToStringData(): array
new Compound([new Integer(), new String_()]),
new String_()
),
'non-empty-array<string,int|string>',
'non-empty-array<string, int|string>',
],
];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Types/ArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function provideToStringData(): array
'array of mixed' => [new Array_(new Mixed_()), 'mixed[]'],
'array of single type' => [new Array_(new String_()), 'string[]'],
'array of compound type' => [new Array_(new Compound([new Integer(), new String_()])), '(int|string)[]'],
'array with key type' => [new Array_(new String_(), new Integer()), 'array<int,string>'],
'array with key type' => [new Array_(new String_(), new Integer()), 'array<int, string>'],
];
}
}
2 changes: 1 addition & 1 deletion tests/unit/Types/IterableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function provideToStringData(): array
new Iterable_(new Compound([new Integer(), new String_()])),
'iterable<int|string>',
],
'iterable with key type' => [new Iterable_(new String_(), new Integer()), 'iterable<int,string>'],
'iterable with key type' => [new Iterable_(new String_(), new Integer()), 'iterable<int, string>'],
];
}
}