| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 58 | 
| Code Lines | 42 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 7 | ||
| Bugs | 2 | 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  | 
            ||
| 76 | public static function addStatusField(Schema $schema, ExtendExtension $extendExtension, QueryBag $queries)  | 
            ||
| 77 |     { | 
            ||
| 78 | $enumTable = $extendExtension->addEnumField(  | 
            ||
| 79 | $schema,  | 
            ||
| 80 | 'orocrm_sales_opportunity',  | 
            ||
| 81 | 'status',  | 
            ||
| 82 | Opportunity::INTERNAL_STATUS_CODE,  | 
            ||
| 83 | false,  | 
            ||
| 84 | false,  | 
            ||
| 85 | [  | 
            ||
| 86 | 'extend' => ['owner' => ExtendScope::OWNER_SYSTEM],  | 
            ||
| 87 | 'datagrid' => ['is_visible' => DatagridScope::IS_VISIBLE_TRUE],  | 
            ||
| 88 | 'dataaudit' => ['auditable' => true],  | 
            ||
| 89 | 'importexport' => ["order" => 90, "short" => true]  | 
            ||
| 90 | ]  | 
            ||
| 91 | );  | 
            ||
| 92 | |||
| 93 | $options = new OroOptions();  | 
            ||
| 94 | $options->set(  | 
            ||
| 95 | 'enum',  | 
            ||
| 96 | 'immutable_codes',  | 
            ||
| 97 | [  | 
            ||
| 98 | 'in_progress',  | 
            ||
| 99 | 'won',  | 
            ||
| 100 | 'lost'  | 
            ||
| 101 | ]  | 
            ||
| 102 | );  | 
            ||
| 103 | |||
| 104 | $enumTable->addOption(OroOptions::KEY, $options);  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 105 | $statuses = [  | 
            ||
| 106 | 'identification_alignment' => 'Identification & Alignment',  | 
            ||
| 107 | 'needs_analysis' => 'Needs Analysis',  | 
            ||
| 108 | 'solution_development' => 'Solution Development',  | 
            ||
| 109 | 'negotiation' => 'Negotiation',  | 
            ||
| 110 | 'in_progress' => 'In Progress',  | 
            ||
| 111 | 'won' => 'Closed Won',  | 
            ||
| 112 | 'lost' => 'Closed Lost'  | 
            ||
| 113 | ];  | 
            ||
| 114 | $defaultValue = 'in_progress';  | 
            ||
| 115 | $query = 'INSERT INTO oro_enum_opportunity_status (id, name, priority, is_default)  | 
            ||
| 116 | VALUES (:id, :name, :priority, :is_default)';  | 
            ||
| 117 | $i = 1;  | 
            ||
| 118 |         foreach ($statuses as $key => $value) { | 
            ||
| 119 | $dropFieldsQuery = new ParametrizedSqlMigrationQuery();  | 
            ||
| 120 | $dropFieldsQuery->addSql(  | 
            ||
| 121 | $query,  | 
            ||
| 122 | ['id' => $key, 'name' => $value, 'priority' => $i, 'is_default' => $defaultValue === $key],  | 
            ||
| 123 | [  | 
            ||
| 124 | 'id' => Type::STRING,  | 
            ||
| 125 | 'name' => Type::STRING,  | 
            ||
| 126 | 'priority' => Type::INTEGER,  | 
            ||
| 127 | 'is_default' => Type::BOOLEAN  | 
            ||
| 128 | ]  | 
            ||
| 129 | );  | 
            ||
| 130 | $queries->addQuery($dropFieldsQuery);  | 
            ||
| 131 | $i++;  | 
            ||
| 132 | }  | 
            ||
| 133 | }  | 
            ||
| 134 | }  | 
            ||
| 135 | 
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: