| Conditions | 2 | 
| Paths | 1 | 
| Total Lines | 51 | 
| Code Lines | 33 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 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  | 
            ||
| 9 | public static function create(Definitions $customOperators): Definitions  | 
            ||
| 10 |     { | 
            ||
| 11 | $defaultInlineOperators = [  | 
            ||
| 12 |             'and' => function ($a, $b) { | 
            ||
| 13 |                 return sprintf('(%s)', OperatorTools::inlineMixedInstructions([$a, $b], 'AND')); | 
            ||
| 14 | },  | 
            ||
| 15 |             'or' => function ($a, $b) { | 
            ||
| 16 |                 return sprintf('(%s)', OperatorTools::inlineMixedInstructions([$a, $b], 'OR')); | 
            ||
| 17 | },  | 
            ||
| 18 |             'not' => function ($a) { | 
            ||
| 19 |                 return sprintf('NOT (%s)', OperatorTools::inlineMixedInstructions([$a])); | 
            ||
| 20 | },  | 
            ||
| 21 |             '=' => function ($a, $b) { | 
            ||
| 22 | return OperatorTools::inlineMixedInstructions([$a, $b], '=');  | 
            ||
| 23 | },  | 
            ||
| 24 |             '!=' => function ($a, $b) { | 
            ||
| 25 | return OperatorTools::inlineMixedInstructions([$a, $b], '!=');  | 
            ||
| 26 | },  | 
            ||
| 27 |             '>' => function ($a, $b) { | 
            ||
| 28 | return OperatorTools::inlineMixedInstructions([$a, $b], '>');  | 
            ||
| 29 | },  | 
            ||
| 30 |             '>=' => function ($a, $b) { | 
            ||
| 31 | return OperatorTools::inlineMixedInstructions([$a, $b], '>=');  | 
            ||
| 32 | },  | 
            ||
| 33 |             '<' => function ($a, $b) { | 
            ||
| 34 | return OperatorTools::inlineMixedInstructions([$a, $b], '<');  | 
            ||
| 35 | },  | 
            ||
| 36 |             '<=' => function ($a, $b) { | 
            ||
| 37 | return OperatorTools::inlineMixedInstructions([$a, $b], '<=');  | 
            ||
| 38 | },  | 
            ||
| 39 |             'in' => function ($a, $b) { | 
            ||
| 40 |                 if ($b[0] === '(') { | 
            ||
| 41 | return OperatorTools::inlineMixedInstructions([$a, $b], 'IN');  | 
            ||
| 42 |                 } else { | 
            ||
| 43 | return sprintf(  | 
            ||
| 44 | '%s IN (%s)',  | 
            ||
| 45 | OperatorTools::inlineMixedInstructions([$a]),  | 
            ||
| 46 | OperatorTools::inlineMixedInstructions([$b])  | 
            ||
| 47 | );  | 
            ||
| 48 | }  | 
            ||
| 49 | },  | 
            ||
| 50 |             'like' => function ($a, $b) { | 
            ||
| 51 | return OperatorTools::inlineMixedInstructions([$a, $b], 'LIKE');  | 
            ||
| 52 | },  | 
            ||
| 53 | ];  | 
            ||
| 54 | |||
| 55 | $definitions = new Definitions();  | 
            ||
| 56 | $definitions->defineInlineOperators($defaultInlineOperators);  | 
            ||
| 57 | |||
| 58 | return $definitions->mergeWith($customOperators);  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 59 | }  | 
            ||
| 60 | }  | 
            ||
| 61 | 
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: