Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Jan 18, 2024
1 parent d8bdecd commit acddb7c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3754,9 +3754,7 @@ private static function getArrayKeyExistsAssertions(
|| $atomic_type instanceof TKeyedArray
) {
if ($atomic_type instanceof TKeyedArray) {
$key_type = $atomic_type->getGenericKeyType(
!$atomic_type->allShapeKeysAlwaysDefined(),
);
$key_type = $atomic_type->getGenericKeyType();
} else {
$key_type = $atomic_type->type_params[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Type/TypeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ private static function getTypeFromGenericTree(

if ($changed) {
$generic_params[0] = $generic_params[0]->setTypes(
$final ?: [Type::getArrayKey($from_docblock)],
$final ?: [new TArrayKey($from_docblock)],
);
}
if ($literals) {
Expand Down
2 changes: 1 addition & 1 deletion tests/TypeCombinationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public function providerTestValidTypeCombination(): array
],
],
'objectLikePlusArrayEqualsArray' => [
"array<'a'|'b'|'c', 1|2|3>",
"array{a?: 1|2|3, b?: 1|2|3, c?: 1|2|3}",
[
'array<"a"|"b"|"c", 1|2|3>',
'array{a: 1|2, b: 2|3, c: 1|3}',
Expand Down
2 changes: 1 addition & 1 deletion tests/TypeParseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function testArrayWithLiteralKeys(): void

// TODO: needs a non-empty flag for unsealed arrays
$this->assertSame('non-empty-array<0|1, string>', Type::parseString('non-empty-array<0|1, string>')->getId(true));
$this->assertSame("non-empty-array<'a'|'b', string>", (string) Type::parseString('non-empty-array<"a"|"b", string>')->getId(true));
$this->assertSame("non-empty-array<'a'|'b', string>", Type::parseString('non-empty-array<"a"|"b", string>')->getId(true));
}

public function testGeneric(): void
Expand Down

0 comments on commit acddb7c

Please sign in to comment.