diff --git a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php index db388ab70b..a921582dba 100644 --- a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php +++ b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php @@ -54,8 +54,7 @@ class TwigExtractor extends AbstractFileExtractor implements ExtractorInterface */ public function extract($resource, MessageCatalogue $catalogue) { - $files = $this->extractFiles($resource); - foreach ($files as $file) { + foreach ($this->extractFiles($resource) as $file) { try { $this->extractTemplate(file_get_contents($file->getPathname()), $catalogue); } catch (Error $e) { diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index cccea633dd..a387b5245e 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -1039,8 +1039,6 @@ class Crawler extends \SplObjectStorage */ private function createSubCrawler($nodes) { - $crawler = new static($nodes, $this->uri, $this->baseHref); - - return $crawler; + return new static($nodes, $this->uri, $this->baseHref); } } diff --git a/src/Symfony/Component/Form/ChoiceList/LegacyChoiceListAdapter.php b/src/Symfony/Component/Form/ChoiceList/LegacyChoiceListAdapter.php index 929ef8c290..57ec192e49 100644 --- a/src/Symfony/Component/Form/ChoiceList/LegacyChoiceListAdapter.php +++ b/src/Symfony/Component/Form/ChoiceList/LegacyChoiceListAdapter.php @@ -133,9 +133,7 @@ class LegacyChoiceListAdapter implements ChoiceListInterface $this->values = array(); $this->structuredValues = $this->adaptedList->getValues(); - $innerChoices = $this->adaptedList->getChoices(); - - foreach ($innerChoices as $index => $choice) { + foreach ($this->adaptedList->getChoices() as $index => $choice) { $value = $this->structuredValues[$index]; $this->values[] = $value; $this->choices[$value] = $choice; diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php index d8e8ff3176..9c5642b116 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php @@ -81,6 +81,7 @@ class FormType extends BaseType } } + $formConfig = $form->getConfig(); $view->vars = array_replace($view->vars, array( 'read_only' => $readOnly, 'errors' => $form->getErrors(), @@ -92,9 +93,9 @@ class FormType extends BaseType 'pattern' => isset($options['attr']['pattern']) ? $options['attr']['pattern'] : null, // Deprecated 'size' => null, 'label_attr' => $options['label_attr'], - 'compound' => $form->getConfig()->getCompound(), - 'method' => $form->getConfig()->getMethod(), - 'action' => $form->getConfig()->getAction(), + 'compound' => $formConfig->getCompound(), + 'method' => $formConfig->getMethod(), + 'action' => $formConfig->getAction(), 'submitted' => $form->isSubmitted(), )); } diff --git a/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php b/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php index 4bebce09cd..884bfca9e4 100644 --- a/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php +++ b/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php @@ -61,9 +61,7 @@ class ValidationListener implements EventSubscriberInterface if ($form->isRoot()) { // Validate the form in group "Default" - $violations = $this->validator->validate($form); - - foreach ($violations as $violation) { + foreach ($this->validator->validate($form) as $violation) { // Allow the "invalid" constraint to be put onto // non-synchronized forms // ConstraintViolation::getConstraint() must not expect to provide a constraint as long as Symfony\Component\Validator\ExecutionContext exists (before 3.0) diff --git a/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php b/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php index 90dadd08d9..f40347d2a1 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php +++ b/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php @@ -261,12 +261,8 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface $classMetadata = $this->metadataFactory->getMetadataFor($class); if ($classMetadata instanceof ClassMetadataInterface && $classMetadata->hasPropertyMetadata($property)) { - $memberMetadatas = $classMetadata->getPropertyMetadata($property); - - foreach ($memberMetadatas as $memberMetadata) { - $constraints = $memberMetadata->getConstraints(); - - foreach ($constraints as $constraint) { + foreach ($classMetadata->getPropertyMetadata($property) as $memberMetadata) { + foreach ($memberMetadata->getConstraints() as $constraint) { if ($guess = $closure($constraint)) { $guesses[] = $guess; }