fix phpstan (#29397)

This commit is contained in:
Frédéric FRANCE 2024-04-20 23:45:52 +02:00 committed by GitHub
parent 5d421b1437
commit 64508a3909
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 20 deletions

View file

@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -718,16 +719,16 @@ class ProductCombination
* [...]
* )
*
* @param User $user Object user
* @param Product $product Parent product
* @param array<array<string,string>> $combinations Attribute and value combinations.
* @param User $user Object user
* @param Product $product Parent product
* @param array<int,int> $combinations Attribute and value combinations.
* @param array<string,array<string,array{weight:string|float,price:string|float}>> $variations Price and weight variations
* @param bool|array $price_var_percent Is the price variation a relative variation?
* @param bool|float $forced_pricevar If the price variation is forced
* @param bool|float $forced_weightvar If the weight variation is forced
* @param bool|string $forced_refvar If the reference is forced
* @param string $ref_ext External reference
* @return int<-1,1> Return integer <0 KO, >0 OK
* @param bool|array $price_var_percent Is the price variation a relative variation?
* @param bool|float $forced_pricevar If the price variation is forced
* @param bool|float $forced_weightvar If the weight variation is forced
* @param bool|string $forced_refvar If the reference is forced
* @param string $ref_ext External reference
* @return int<-1,1> Return integer <0 KO, >0 OK
*/
public function createProductCombination(User $user, Product $product, array $combinations, array $variations, $price_var_percent = false, $forced_pricevar = false, $forced_weightvar = false, $forced_refvar = false, $ref_ext = '')
{
@ -794,7 +795,6 @@ class ProductCombination
$prodattrval = new ProductAttributeValue($this->db);
// $combination contains list of attributes pairs key->value. Example: array('id Color'=>id Blue, 'id Size'=>id Small, 'id Option'=>id val a, ...)
//var_dump($combinations);
foreach ($combinations as $currcombattr => $currcombval) {
//This was checked earlier, so no need to double check
$prodattr->fetch($currcombattr);

View file

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Open-Dsi <support@open-dsi.fr>
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2022 Open-Dsi <support@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -172,7 +172,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST(
}
// Valuepair
$sanit_features[$explode[0]] = $explode[1];
$sanit_features[(int) $explode[0]] = (int) $explode[1];
$tmp = new ProductCombination2ValuePair($db);
$tmp->fk_prod_attr = (int) $explode[0];
@ -185,7 +185,6 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST(
// sanit_feature is an array with 1 (and only 1) value per attribute.
// For example: Color->blue, Size->Small, Option->2
//var_dump($sanit_features);
if (!$prodcomb->fetchByProductCombination2ValuePairs($id, $sanit_features)) {
$result = $prodcomb->createProductCombination($user, $object, $sanit_features, array(), $level_price_impact_percent, $level_price_impact, $weight_impact, $reference);
if ($result > 0) {