| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| Code Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 5 | ||
| Bugs | 0 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 92 | public function buildEditForm(FormMapper $form, BlockInterface $block) |
||
| 93 | { |
||
| 94 | $form->add('settings', 'sonata_type_immutable_array', array( |
||
| 95 | 'keys' => array( |
||
| 96 | array('tweet', 'textarea', array( |
||
| 97 | 'required' => true, |
||
| 98 | 'label' => 'form.label_tweet', |
||
| 99 | 'help_block' => 'form.help_tweet', |
||
| 100 | )), |
||
| 101 | array('maxwidth', 'integer', array( |
||
| 102 | 'required' => false, |
||
| 103 | 'label' => 'form.label_maxwidth', |
||
| 104 | 'help_block' => 'form.help_maxwidth', |
||
| 105 | )), |
||
| 106 | array('hide_media', 'checkbox', array( |
||
| 107 | 'required' => false, |
||
| 108 | 'label' => 'form.label_hide_media', |
||
| 109 | 'help_block' => 'form.help_hide_media', |
||
| 110 | )), |
||
| 111 | array('hide_thread', 'checkbox', array( |
||
| 112 | 'required' => false, |
||
| 113 | 'label' => 'form.label_hide_thread', |
||
| 114 | 'help_block' => 'form.help_hide_thread', |
||
| 115 | )), |
||
| 116 | array('omit_script', 'checkbox', array( |
||
| 117 | 'required' => false, |
||
| 118 | 'label' => 'form.label_omit_script', |
||
| 119 | 'help_block' => 'form.help_omit_script', |
||
| 120 | )), |
||
| 121 | array('align', 'choice', array( |
||
| 122 | 'required' => false, |
||
| 123 | 'choices' => array( |
||
| 124 | 'left' => 'form.label_align_left', |
||
| 125 | 'right' => 'form.label_align_right', |
||
| 126 | 'center' => 'form.label_align_center', |
||
| 127 | 'none' => 'form.label_align_none', |
||
| 128 | ), |
||
| 129 | 'label' => 'form.label_align', |
||
| 130 | )), |
||
| 131 | array('related', 'text', array( |
||
| 132 | 'required' => false, |
||
| 133 | 'label' => 'form.label_related', |
||
| 134 | 'help_block' => 'form.help_related', |
||
| 135 | )), |
||
| 136 | array('lang', 'choice', array( |
||
| 137 | 'required' => true, |
||
| 138 | 'choices' => $this->languageList, |
||
| 139 | 'label' => 'form.label_lang', |
||
| 140 | )), |
||
| 141 | ), |
||
| 142 | 'translation_domain' => 'SonataSeoBundle', |
||
| 143 | )); |
||
| 144 | } |
||
| 145 | |||
| 208 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: