Skip to content

Commit cbab7d4

Browse files
Merge branch '7.4' into 8.0
* 7.4: Fix remaining SplObjectStorage deprecation Remove calls to no-op functions, deprecated in PHP 8.5 Remove deprecated calls to deprecated methods of SplObjectStorage [Messenger] Show package installation hint also for amqps [TypeInfo] Fix converting list to string
2 parents b780360 + 63f8e1f commit cbab7d4

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Tests/Type/CollectionTypeTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public function testToString()
8787

8888
$type = new CollectionType(new GenericType(Type::builtin(TypeIdentifier::ARRAY), Type::string(), Type::bool()));
8989
$this->assertEquals('array<string,bool>', (string) $type);
90+
91+
$type = new CollectionType(Type::generic(Type::builtin(TypeIdentifier::ARRAY), Type::bool()), isList: true);
92+
$this->assertEquals('list<bool>', (string) $type);
9093
}
9194

9295
public function testAccepts()

Type/CollectionType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ public function accepts(mixed $value): bool
178178

179179
public function __toString(): string
180180
{
181+
if ($this->isList && $this->type->isIdentifiedBy(TypeIdentifier::ARRAY)) {
182+
return 'list<'.$this->getCollectionValueType().'>';
183+
}
184+
181185
return (string) $this->type;
182186
}
183187
}

0 commit comments

Comments
 (0)