Jordi Boggiano пре 14 година
родитељ
комит
fbc29f061c

+ 1 - 1
src/Symfony/Bundle/DoctrineBundle/Form/ValueTransformer/EntityToIDTransformer.php

@@ -35,7 +35,7 @@ class EntityToIDTransformer extends BaseValueTransformer
      * Reverse Transforming the selected id value to an Doctrine Entity.
      *
      * This handles NULL, the EntityManager#find method returns null if no entity was found.
-     * 
+     *
      * @param  int|string $newId
      * @param  object $oldEntity
      * @return object

+ 5 - 7
src/Symfony/Component/Form/ChoiceField.php

@@ -129,12 +129,11 @@ class ChoiceField extends HybridField
                 'value' => $choice,
                 'label' => $label,
             ));
-        } else {
-            return new RadioField($choice, array(
-                'value' => $choice,
-                'label' => $label,
-            ));
         }
+        return new RadioField($choice, array(
+            'value' => $choice,
+            'label' => $label,
+        ));
     }
 
     /**
@@ -178,9 +177,8 @@ class ChoiceField extends HybridField
             }
 
             return $choices;
-        } else {
-            return parent::transform($value);
         }
+        return parent::transform($value);
     }
 
     /**

+ 6 - 12
src/Symfony/Component/Form/Field.php

@@ -183,9 +183,8 @@ abstract class Field extends Configurable implements FieldInterface
     {
         if (is_null($this->parent) || $this->parent->isRequired()) {
             return $this->required;
-        } else {
-            return false;
         }
+        return false;
     }
 
     /**
@@ -195,9 +194,8 @@ abstract class Field extends Configurable implements FieldInterface
     {
         if (is_null($this->parent) || !$this->parent->isDisabled()) {
             return $this->getOption('disabled');
-        } else {
-            return true;
         }
+        return true;
     }
 
     /**
@@ -441,9 +439,8 @@ abstract class Field extends Configurable implements FieldInterface
     {
         if (null === $this->normalizationTransformer) {
             return $value;
-        } else {
-            return $this->normalizationTransformer->transform($value);
         }
+        return $this->normalizationTransformer->transform($value);
     }
 
     /**
@@ -456,9 +453,8 @@ abstract class Field extends Configurable implements FieldInterface
     {
         if (null === $this->normalizationTransformer) {
             return $value;
-        } else {
-            return $this->normalizationTransformer->reverseTransform($value, $this->data);
         }
+        return $this->normalizationTransformer->reverseTransform($value, $this->data);
     }
 
     /**
@@ -471,9 +467,8 @@ abstract class Field extends Configurable implements FieldInterface
     {
         if (null === $this->valueTransformer) {
             return $value === null ? '' : $value;
-        } else {
-            return $this->valueTransformer->transform($value);
         }
+        return $this->valueTransformer->transform($value);
     }
 
     /**
@@ -486,9 +481,8 @@ abstract class Field extends Configurable implements FieldInterface
     {
         if (null === $this->valueTransformer) {
             return $value === '' ? null : $value;
-        } else {
-            return $this->valueTransformer->reverseTransform($value, $this->data);
         }
+        return $this->valueTransformer->reverseTransform($value, $this->data);
     }
 
     /**