Skip to content

Commit

Permalink
Simplified checks for array and traversable values
Browse files Browse the repository at this point in the history
  • Loading branch information
phansys authored and greg0ire committed Oct 8, 2019
1 parent f06a91b commit 90c9e07
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Admin/AbstractAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3029,7 +3029,7 @@ protected function buildForm()

$value = $propertyAccessor->getValue($object, $propertyPath);

if (\is_array($value) || ($value instanceof \Traversable && $value instanceof \ArrayAccess)) {
if (\is_array($value) || $value instanceof \ArrayAccess) {
$value[] = $parent;
$propertyAccessor->setValue($object, $propertyPath, $value);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Type/ChoiceFieldMaskType.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
$sanitizedMap = [];
$allFieldNames = [];
foreach ($options['map'] as $value => $fieldNames) {
if (\is_array($fieldNames) || $fieldNames instanceof \Traversable) {
if (is_iterable($fieldNames)) {
foreach ($fieldNames as $fieldName) {
$sanitizedFieldName = str_replace(['__', '.'], ['____', '__'], $fieldName);
$sanitizedMap[$value][] = $sanitizedFieldName;
Expand Down

0 comments on commit 90c9e07

Please sign in to comment.