2
0
forked from Wavyzz/dolibarr

Fix most PhanTypeMismatchDimAssignment notices (#28739)

* Qual: Add typing to fix PhanTypeMismatchDimAssignment notice

* Fix: Initialise array for code in somme

* Qual: Update type hint for  argument in _Set_Format

* Qual: Update type hint for childtables

* Qual: Add typing to attributes

* Qual: Add typing for _msgContent

* Qual: Suppress PhanTypeMismatchDimAssignment

* Qual: Add typing for liste

* Qual: Add typing to fields

* Qual: Add typing hint for $objMod

* Qual: Modify assignment of array with bool keys for phan typing

Demonstration:
```
php -r '$a=[true=>"yes",false=>"no"];var_dump($a);'
# Result demonstrates bool keys are converted to int.
Command line code:1:
array(2) {
  [1] =>
  string(3) "yes"
  [0] =>
  string(2) "no"
}
```

* Qual: Add typing hint to indicate value is not null

* Force non-null type on $paramname

* Qual: Add typing hint to getCats()

* Update inc.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
MDW
2024-03-10 01:53:04 +01:00
committed by GitHub
parent c95bab2818
commit 37afba949e
14 changed files with 98 additions and 84 deletions

View File

@@ -101,6 +101,7 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu
if (!empty($object->isextrafieldmanaged) && isset($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || (int) dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1, 1, '1'))) {
// @phan-suppress-next-line PhanTypeMismatchDimAssignment
$position = (!empty($val['position']) ? $val['position'] : 0);
$arrayofmesures[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-sum'] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>',