| Conditions | 13 | 
| Paths | 4 | 
| Total Lines | 94 | 
| Code Lines | 66 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 9 | ||
| Bugs | 1 | Features | 0 | 
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  | 
            ||
| 112 | protected function configureOptionsResolver(OptionsResolver $resolver, $actionName, Admin $admin = null)  | 
            ||
| 113 |     { | 
            ||
| 114 | $defaultCriteria = [];  | 
            ||
| 115 | $defaultLoadStrategy = Admin::LOAD_STRATEGY_UNIQUE;  | 
            ||
| 116 | |||
| 117 |         if ($actionName == 'edit') { | 
            ||
| 118 | $defaultCriteria = [  | 
            ||
| 119 | 'id'  | 
            ||
| 120 | ];  | 
            ||
| 121 |         } else if ($actionName == 'delete') { | 
            ||
| 122 | $defaultCriteria = [  | 
            ||
| 123 | 'id'  | 
            ||
| 124 | ];  | 
            ||
| 125 |         } else if ($actionName == 'create') { | 
            ||
| 126 | $defaultLoadStrategy = Admin::LOAD_STRATEGY_NONE;  | 
            ||
| 127 | }  | 
            ||
| 128 | |||
| 129 | $resolver  | 
            ||
| 130 | ->setDefaults([  | 
            ||
| 131 | 'title' => null,  | 
            ||
| 132 | 'fields' => [  | 
            ||
| 133 | 'id' => [],  | 
            ||
| 134 | ],  | 
            ||
| 135 | 'permissions' => ['ROLE_ADMIN'],  | 
            ||
| 136 | 'export' => [  | 
            ||
| 137 | 'json',  | 
            ||
| 138 | 'html',  | 
            ||
| 139 | 'csv',  | 
            ||
| 140 | 'xls'  | 
            ||
| 141 | ],  | 
            ||
| 142 | 'order' => [],  | 
            ||
| 143 | 'actions' => [],  | 
            ||
| 144 | 'submit_actions' => [],  | 
            ||
| 145 | 'target' => '_self',  | 
            ||
| 146 | 'route' => '',  | 
            ||
| 147 | 'parameters' => [],  | 
            ||
| 148 | 'icon' => null,  | 
            ||
| 149 | 'filters' => [],  | 
            ||
| 150 | 'batch' => [],  | 
            ||
| 151 | 'load_strategy' => $defaultLoadStrategy,  | 
            ||
| 152 | 'pager' => 'pagerfanta',  | 
            ||
| 153 | 'criteria' => $defaultCriteria  | 
            ||
| 154 | ])  | 
            ||
| 155 |             ->setAllowedValues('pager', [ | 
            ||
| 156 | null,  | 
            ||
| 157 | 'pagerfanta',  | 
            ||
| 158 | ])  | 
            ||
| 159 |             ->setAllowedValues('load_strategy', [ | 
            ||
| 160 | Admin::LOAD_STRATEGY_NONE,  | 
            ||
| 161 | Admin::LOAD_STRATEGY_UNIQUE,  | 
            ||
| 162 | Admin::LOAD_STRATEGY_MULTIPLE,  | 
            ||
| 163 | ])  | 
            ||
| 164 |             ->setNormalizer('route', function (Options $options, $value) use ($admin, $actionName) { | 
            ||
| 165 |                 if (!$value) { | 
            ||
| 166 | // if no route was provided, it should be linked to an Admin  | 
            ||
| 167 |                     if (!$admin) { | 
            ||
| 168 |                         throw new Exception('No route was provided for action : ' . $actionName); | 
            ||
| 169 | }  | 
            ||
| 170 | return $admin  | 
            ||
| 171 | ->generateRouteName($actionName);  | 
            ||
| 172 | }  | 
            ||
| 173 | return $value;  | 
            ||
| 174 | })  | 
            ||
| 175 |             ->setNormalizer('title', function (Options $options, $value) use ($admin, $actionName) { | 
            ||
| 176 |                 if (!$value) { | 
            ||
| 177 | $adminKey = '';  | 
            ||
| 178 | // if an Admin is linked to this action, we use its name in translation key  | 
            ||
| 179 |                     if ($admin) { | 
            ||
| 180 | $adminKey = $admin->getName();  | 
            ||
| 181 | }  | 
            ||
| 182 | return $this->configuration->getTranslationKey($actionName, $adminKey);  | 
            ||
| 183 | }  | 
            ||
| 184 | return $value;  | 
            ||
| 185 | })  | 
            ||
| 186 |             ->setNormalizer('batch', function (Options $options, $value) use ($admin, $actionName) { | 
            ||
| 187 |                 if ($value) { | 
            ||
| 188 |                     if (!is_array($value)) { | 
            ||
| 189 | $value = [$value];  | 
            ||
| 190 | }  | 
            ||
| 191 |                     foreach ($value as $key => $title) { | 
            ||
| 192 |                         if (!$title) { | 
            ||
| 193 | $adminKey = '';  | 
            ||
| 194 | // if an Admin is linked to this action, we use its name in translation key  | 
            ||
| 195 |                             if ($admin) { | 
            ||
| 196 | $adminKey = $admin->getName();  | 
            ||
| 197 | }  | 
            ||
| 198 |                             $value[$key] = $this->configuration->getTranslationKey('batch.' . $key, $adminKey); | 
            ||
| 199 | }  | 
            ||
| 200 | }  | 
            ||
| 201 | }  | 
            ||
| 202 | return $value;  | 
            ||
| 203 | })  | 
            ||
| 204 | ;  | 
            ||
| 205 | }  | 
            ||
| 206 | }  | 
            ||
| 207 | 
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: