7]; $items = StructuredData::collectionItems(new Collection(['row' => $row])); self::assertSame(['row' => $row], $items); self::assertSame($row, $items['row']); $generator = (static function () use ($row) { yield 'row' => $row; })(); self::assertSame(['row' => $row], StructuredData::collectionItems($generator)); } public function test_invalid_scalar_cannot_be_recovered_as_an_empty_collection(): void { $this->expectException(UnexpectedValueException::class); StructuredData::collectionItems('invalid structured snapshot'); } public function test_invalid_unicode_fails_without_overwriting_the_source(): void { $source = "original\xFF"; try { CheckedPattern::split('/\s+/u', $source); self::fail('Malformed text must not be accepted as an empty result.'); } catch (\RuntimeException) { self::assertSame("original\xFF", $source); } } }