Skip to content

Commit 0469cee

Browse files
committed
Fix SelectFormatter
1 parent 06d046b commit 0469cee

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Form/Fields/Formatters/SelectFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class SelectFormatter extends SharpFieldFormatter
1414
public function toFront(SharpFormField $field, $value)
1515
{
1616
if ($field->multiple()) {
17-
return collect((array) $value)
17+
return collect($value)
1818
->map(function ($item) use ($field) {
1919
$item = ArrayConverter::modelToArray($item);
2020

tests/Unit/Form/Fields/Formatters/SelectFormatterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
->setMultiple();
2424

2525
$this->assertEquals([1, 2], $formatter->toFront($field, [1, 2]));
26+
$this->assertEquals([1], $formatter->toFront($field, 1));
2627
});
2728

2829
it('allows to format a multiple array value to front', function () {

0 commit comments

Comments
 (0)