Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php  | 
            ||
| 48 | class BunchSubject extends AbstractProductSubject implements ExportableSubjectInterface, FileUploadSubjectInterface, UrlKeyAwareSubjectInterface  | 
            ||
| 49 | { | 
            ||
| 50 | |||
| 51 | /**  | 
            ||
| 52 | * The trait that implements the export functionality.  | 
            ||
| 53 | *  | 
            ||
| 54 | * @var \TechDivision\Import\Subjects\ExportableTrait  | 
            ||
| 55 | */  | 
            ||
| 56 | use ExportableTrait;  | 
            ||
| 57 | |||
| 58 | /**  | 
            ||
| 59 | * The trait that provides file upload functionality.  | 
            ||
| 60 | *  | 
            ||
| 61 | * @var \TechDivision\Import\Subjects\FileUploadTrait  | 
            ||
| 62 | */  | 
            ||
| 63 | use FileUploadTrait;  | 
            ||
| 64 | |||
| 65 | /**  | 
            ||
| 66 | * The array with the pre-loaded entity IDs.  | 
            ||
| 67 | *  | 
            ||
| 68 | * @var array  | 
            ||
| 69 | */  | 
            ||
| 70 | protected $preLoadedEntityIds = array();  | 
            ||
| 71 | |||
| 72 | /**  | 
            ||
| 73 | * Mappings for the table column => CSV column header.  | 
            ||
| 74 | *  | 
            ||
| 75 | * @var array  | 
            ||
| 76 | */  | 
            ||
| 77 | protected $headerStockMappings = array(  | 
            ||
| 78 |         'qty'                         => array('qty', 'float'), | 
            ||
| 79 |         'min_qty'                     => array('out_of_stock_qty', 'float'), | 
            ||
| 80 |         'use_config_min_qty'          => array('use_config_min_qty', 'int'), | 
            ||
| 81 |         'is_qty_decimal'              => array('is_qty_decimal', 'int'), | 
            ||
| 82 |         'backorders'                  => array('allow_backorders', 'int'), | 
            ||
| 83 |         'use_config_backorders'       => array('use_config_backorders', 'int'), | 
            ||
| 84 |         'min_sale_qty'                => array('min_cart_qty', 'float'), | 
            ||
| 85 |         'use_config_min_sale_qty'     => array('use_config_min_sale_qty', 'int'), | 
            ||
| 86 |         'max_sale_qty'                => array('max_cart_qty', 'float'), | 
            ||
| 87 |         'use_config_max_sale_qty'     => array('use_config_max_sale_qty', 'int'), | 
            ||
| 88 |         'is_in_stock'                 => array('is_in_stock', 'int'), | 
            ||
| 89 |         'notify_stock_qty'            => array('notify_on_stock_below', 'float'), | 
            ||
| 90 |         'use_config_notify_stock_qty' => array('use_config_notify_stock_qty', 'int'), | 
            ||
| 91 |         'manage_stock'                => array('manage_stock', 'int'), | 
            ||
| 92 |         'use_config_manage_stock'     => array('use_config_manage_stock', 'int'), | 
            ||
| 93 |         'use_config_qty_increments'   => array('use_config_qty_increments', 'int'), | 
            ||
| 94 |         'qty_increments'              => array('qty_increments', 'float'), | 
            ||
| 95 |         'use_config_enable_qty_inc'   => array('use_config_enable_qty_inc', 'int'), | 
            ||
| 96 |         'enable_qty_increments'       => array('enable_qty_increments', 'int'), | 
            ||
| 97 |         'is_decimal_divided'          => array('is_decimal_divided', 'int'), | 
            ||
| 98 | );  | 
            ||
| 99 | |||
| 100 | /**  | 
            ||
| 101 | * The array with the available visibility keys.  | 
            ||
| 102 | *  | 
            ||
| 103 | * @var array  | 
            ||
| 104 | */  | 
            ||
| 105 | protected $availableVisibilities = array(  | 
            ||
| 106 | 'Not Visible Individually' => VisibilityKeys::VISIBILITY_NOT_VISIBLE,  | 
            ||
| 107 | 'Catalog' => VisibilityKeys::VISIBILITY_IN_CATALOG,  | 
            ||
| 108 | 'Search' => VisibilityKeys::VISIBILITY_IN_SEARCH,  | 
            ||
| 109 | 'Catalog, Search' => VisibilityKeys::VISIBILITY_BOTH  | 
            ||
| 110 | );  | 
            ||
| 111 | |||
| 112 | /**  | 
            ||
| 113 | * The default callback mappings for the Magento standard product attributes.  | 
            ||
| 114 | *  | 
            ||
| 115 | * @var array  | 
            ||
| 116 | */  | 
            ||
| 117 | protected $defaultCallbackMappings = array(  | 
            ||
| 118 |         'visibility'           => array('import_product.callback.visibility'), | 
            ||
| 119 |         'tax_class_id'         => array('import_product.callback.tax.class'), | 
            ||
| 120 |         'bundle_price_type'    => array('import_product_bundle.callback.bundle.type'), | 
            ||
| 121 |         'bundle_sku_type'      => array('import_product_bundle.callback.bundle.type'), | 
            ||
| 122 |         'bundle_weight_type'   => array('import_product_bundle.callback.bundle.type'), | 
            ||
| 123 |         'bundle_price_view'    => array('import_product_bundle.callback.bundle.price.view'), | 
            ||
| 124 |         'bundle_shipment_type' => array('import_product_bundle.callback.bundle.shipment.type') | 
            ||
| 125 | );  | 
            ||
| 126 | |||
| 127 | /**  | 
            ||
| 128 | * The available entity types.  | 
            ||
| 129 | *  | 
            ||
| 130 | * @var array  | 
            ||
| 131 | */  | 
            ||
| 132 | protected $entityTypes = array();  | 
            ||
| 133 | |||
| 134 | /**  | 
            ||
| 135 | * The media roles loader instance.  | 
            ||
| 136 | *  | 
            ||
| 137 | * @var \TechDivision\Import\Loaders\LoaderInterface  | 
            ||
| 138 | */  | 
            ||
| 139 | protected $mediaRolesLoader;  | 
            ||
| 140 | |||
| 141 | /**  | 
            ||
| 142 | * BunchSubject constructor  | 
            ||
| 143 | *  | 
            ||
| 144 | * @param RegistryProcessorInterface $registryProcessor The registry processor instance  | 
            ||
| 145 | * @param GeneratorInterface $coreConfigDataUidGenerator The generator instance  | 
            ||
| 146 | * @param Collection $systemLoggers The system logger collection  | 
            ||
| 147 | * @param EmitterInterface $emitter The emitter instance  | 
            ||
| 148 | * @param LoaderInterface $loader The media type loader instance  | 
            ||
| 149 | */  | 
            ||
| 150 | public function __construct(  | 
            ||
| 160 | |||
| 161 | /**  | 
            ||
| 162 | * Intializes the previously loaded global data for exactly one bunch.  | 
            ||
| 163 | *  | 
            ||
| 164 | * @param string $serial The serial of the actual import  | 
            ||
| 165 | *  | 
            ||
| 166 | * @return void  | 
            ||
| 167 | */  | 
            ||
| 168 | public function setUp($serial)  | 
            ||
| 203 | |||
| 204 | /**  | 
            ||
| 205 | * Clean up the global data after importing the bunch.  | 
            ||
| 206 | *  | 
            ||
| 207 | * @param string $serial The serial of the actual import  | 
            ||
| 208 | *  | 
            ||
| 209 | * @return void  | 
            ||
| 210 | */  | 
            ||
| 211 | public function tearDown($serial)  | 
            ||
| 228 | |||
| 229 | /**  | 
            ||
| 230 | * Return's the default callback mappings.  | 
            ||
| 231 | *  | 
            ||
| 232 | * @return array The default callback mappings  | 
            ||
| 233 | */  | 
            ||
| 234 | public function getDefaultCallbackMappings()  | 
            ||
| 238 | |||
| 239 | /**  | 
            ||
| 240 | * Return's the mappings for the table column => CSV column header.  | 
            ||
| 241 | *  | 
            ||
| 242 | * @return array The header stock mappings  | 
            ||
| 243 | */  | 
            ||
| 244 | 1 | public function getHeaderStockMappings()  | 
            |
| 248 | |||
| 249 | /**  | 
            ||
| 250 | * Return's the visibility key for the passed visibility string.  | 
            ||
| 251 | *  | 
            ||
| 252 | * @param string $visibility The visibility string to return the key for  | 
            ||
| 253 | *  | 
            ||
| 254 | * @return integer The requested visibility key  | 
            ||
| 255 | * @throws \Exception Is thrown, if the requested visibility is not available  | 
            ||
| 256 | */  | 
            ||
| 257 | public function getVisibilityIdByValue($visibility)  | 
            ||
| 273 | |||
| 274 | /**  | 
            ||
| 275 | * Pre-load the entity ID for the passed product.  | 
            ||
| 276 | *  | 
            ||
| 277 | * @param array $product The product to be pre-loaded  | 
            ||
| 278 | *  | 
            ||
| 279 | * @return void  | 
            ||
| 280 | */  | 
            ||
| 281 | public function preLoadEntityId(array $product)  | 
            ||
| 285 | |||
| 286 | /**  | 
            ||
| 287 | * Return's the entity type for the configured entity type code.  | 
            ||
| 288 | *  | 
            ||
| 289 | * @return array The requested entity type  | 
            ||
| 290 | * @throws \Exception Is thrown, if the requested entity type is not available  | 
            ||
| 291 | */  | 
            ||
| 292 | View Code Duplication | public function getEntityType()  | 
            |
| 307 | |||
| 308 | /**  | 
            ||
| 309 | * Return's TRUE, if the passed URL key varchar value IS related with the actual PK.  | 
            ||
| 310 | *  | 
            ||
| 311 | * @param array $productVarcharAttribute The varchar value to check  | 
            ||
| 312 | *  | 
            ||
| 313 | * @return boolean TRUE if the URL key is related, else FALSE  | 
            ||
| 314 | */  | 
            ||
| 315 | public function isUrlKeyOf(array $productVarcharAttribute)  | 
            ||
| 320 | |||
| 321 | /**  | 
            ||
| 322 | * Returns the media roles.  | 
            ||
| 323 | *  | 
            ||
| 324 | * @return \ArrayAccess  | 
            ||
| 325 | */  | 
            ||
| 326 | public function getMediaRoles(): array  | 
            ||
| 330 | }  | 
            ||
| 331 | 
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: