Skip to content

Commit e0aa691

Browse files
committed
Php Inspections (EA Ultimate): address some of one-time used local variables
1 parent c320736 commit e0aa691

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

ChoiceList/LegacyChoiceListAdapter.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ private function initialize()
133133
$this->values = array();
134134
$this->structuredValues = $this->adaptedList->getValues();
135135

136-
$innerChoices = $this->adaptedList->getChoices();
137-
138-
foreach ($innerChoices as $index => $choice) {
136+
foreach ($this->adaptedList->getChoices() as $index => $choice) {
139137
$value = $this->structuredValues[$index];
140138
$this->values[] = $value;
141139
$this->choices[$value] = $choice;

Extension/Core/Type/FormType.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
8181
}
8282
}
8383

84+
$formConfig = $form->getConfig();
8485
$view->vars = array_replace($view->vars, array(
8586
'read_only' => $readOnly,
8687
'errors' => $form->getErrors(),
@@ -92,9 +93,9 @@ public function buildView(FormView $view, FormInterface $form, array $options)
9293
'pattern' => isset($options['attr']['pattern']) ? $options['attr']['pattern'] : null, // Deprecated
9394
'size' => null,
9495
'label_attr' => $options['label_attr'],
95-
'compound' => $form->getConfig()->getCompound(),
96-
'method' => $form->getConfig()->getMethod(),
97-
'action' => $form->getConfig()->getAction(),
96+
'compound' => $formConfig->getCompound(),
97+
'method' => $formConfig->getMethod(),
98+
'action' => $formConfig->getAction(),
9899
'submitted' => $form->isSubmitted(),
99100
));
100101
}

Extension/Validator/EventListener/ValidationListener.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ public function validateForm(FormEvent $event)
6161

6262
if ($form->isRoot()) {
6363
// Validate the form in group "Default"
64-
$violations = $this->validator->validate($form);
65-
66-
foreach ($violations as $violation) {
64+
foreach ($this->validator->validate($form) as $violation) {
6765
// Allow the "invalid" constraint to be put onto
6866
// non-synchronized forms
6967
// ConstraintViolation::getConstraint() must not expect to provide a constraint as long as Symfony\Component\Validator\ExecutionContext exists (before 3.0)

Extension/Validator/ValidatorTypeGuesser.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,8 @@ protected function guess($class, $property, \Closure $closure, $defaultValue = n
261261
$classMetadata = $this->metadataFactory->getMetadataFor($class);
262262

263263
if ($classMetadata instanceof ClassMetadataInterface && $classMetadata->hasPropertyMetadata($property)) {
264-
$memberMetadatas = $classMetadata->getPropertyMetadata($property);
265-
266-
foreach ($memberMetadatas as $memberMetadata) {
267-
$constraints = $memberMetadata->getConstraints();
268-
269-
foreach ($constraints as $constraint) {
264+
foreach ($classMetadata->getPropertyMetadata($property) as $memberMetadata) {
265+
foreach ($memberMetadata->getConstraints() as $constraint) {
270266
if ($guess = $closure($constraint)) {
271267
$guesses[] = $guess;
272268
}

0 commit comments

Comments
 (0)