We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
fromArray
1 parent 29ee488 commit db59c8eCopy full SHA for db59c8e
tests/Unit/Usage/Example/ArrayOfStringsTest.php
@@ -75,3 +75,9 @@
75
expect(fn() => new ArrayOfStrings($bad))
76
->toThrow(StringTypeException::class, 'Expected array of StringNonEmpty or Undefined instance');
77
});
78
+
79
+it('casts mixed scalars to strings in fromArray', function (): void {
80
+ // Without explicit (string) cast inside fromArray, this would fail under strict types
81
+ $a = ArrayOfStrings::fromArray([123, 45.6, '789']);
82
+ expect($a->toArray())->toBe(['123', '45.6', '789']);
83
+});
0 commit comments