Skip to content

Commit

Permalink
CS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Riley authored and Ocramius committed Jan 12, 2015
1 parent 383718f commit d0edff8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
18 changes: 5 additions & 13 deletions library/Zend/Form/Annotation/ElementAnnotationsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,9 @@ public function handleComposedObjectAnnotation($e)
}
unset($specification['input_filter']);

// Merge options of composed object with the ones of the target object:
$options = $this->mergeOptions($elementSpec, $annotation);

$elementSpec['spec']['type'] = 'Zend\Form\Element\Collection';
$elementSpec['spec']['name'] = $name;
$elementSpec['spec']['options'] = new ArrayObject($options);
$elementSpec['spec']['options'] = new ArrayObject($this->mergeOptions($elementSpec, $annotation));
$elementSpec['spec']['options']['target_element'] = $specification;
$elementSpec['spec']['options']['target_element']['options']['input_filter_spec'] = $inputFilter;

Expand All @@ -166,13 +163,10 @@ public function handleComposedObjectAnnotation($e)
$specification['type'] = 'Zend\Form\Fieldset';
}

// Merge options of composed object with the ones of the target object:
$options = $this->mergeOptions($elementSpec, $annotation);

// Add element spec:
$elementSpec['spec'] = $specification;
$elementSpec['spec']['name'] = $name;
$elementSpec['spec']['options'] = new ArrayObject($options);
$elementSpec['spec']['options'] = new ArrayObject($this->mergeOptions($elementSpec, $annotation));
}
}

Expand Down Expand Up @@ -326,8 +320,7 @@ public function handleOptionsAnnotation($e)
}

$elementSpec = $e->getParam('elementSpec');
$options = $this->mergeOptions($elementSpec, $annotation);
$elementSpec['spec']['options'] = $options;
$elementSpec['spec']['options'] = $this->mergeOptions($elementSpec, $annotation);
}

/**
Expand Down Expand Up @@ -405,7 +398,7 @@ public function handleValidatorAnnotation($e)
* @param $annotation
* @return array
*/
protected function mergeOptions($elementSpec, $annotation)
private function mergeOptions($elementSpec, $annotation)
{
$options = array();
if (isset($elementSpec['spec']['options'])) {
Expand All @@ -416,7 +409,6 @@ protected function mergeOptions($elementSpec, $annotation)
}
}

$options = array_merge($options, $annotation->getOptions());
return $options;
return array_merge($options, $annotation->getOptions());
}
}
2 changes: 1 addition & 1 deletion tests/ZendTest/Form/Annotation/AnnotationBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function testOptionsAnnotationAndComposedObjectAnnotation($childName)

public function provideOptionsAnnotationAndComposedObjectAnnotation()
{
return [['child'], ['childTheSecond']];
return array(array('child'), array('childTheSecond'));
}

public function testCanHandleOptionsAnnotation()
Expand Down

0 comments on commit d0edff8

Please sign in to comment.