Fix PhanTypeSuspiciousStringExpression

This commit is contained in:
MDW 2024-03-16 22:53:12 +01:00
parent fe5c6484d4
commit 439839f1aa
No known key found for this signature in database

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -82,11 +83,11 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'),
'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'),
'login' => array('name'=>'login', 'type'=>'xsd:string'),
'password' => array('name'=>'password', 'type'=>'xsd:string'),
'entity' => array('name'=>'entity', 'type'=>'xsd:string'),
'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'),
'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'),
'login' => array('name' => 'login', 'type' => 'xsd:string'),
'password' => array('name' => 'password', 'type' => 'xsd:string'),
'entity' => array('name' => 'entity', 'type' => 'xsd:string'),
)
);
@ -98,37 +99,37 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'),
'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'),
'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'),
'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'),
)
);
$actioncomm_fields = array(
'id' => array('name'=>'id', 'type'=>'xsd:string'),
'ref' => array('name'=>'ref', 'type'=>'xsd:string'),
'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'),
'type_id' => array('name'=>'type_id', 'type'=>'xsd:string'),
'type_code' => array('name'=>'type_code', 'type'=>'xsd:string'),
'type' => array('name'=>'type', 'type'=>'xsd:string'),
'label' => array('name'=>'label', 'type'=>'xsd:string'),
'datep' => array('name'=>'datep', 'type'=>'xsd:dateTime'),
'datef' => array('name'=>'datef', 'type'=>'xsd:dateTime'),
'datec' => array('name'=>'datec', 'type'=>'xsd:dateTime'),
'datem' => array('name'=>'datem', 'type'=>'xsd:dateTime'),
'note' => array('name'=>'note', 'type'=>'xsd:string'),
'percentage' => array('name'=>'percentage', 'type'=>'xsd:string'),
'author' => array('name'=>'author', 'type'=>'xsd:string'),
'usermod' => array('name'=>'usermod', 'type'=>'xsd:string'),
'userownerid' => array('name'=>'userownerid', 'type'=>'xsd:string'),
'priority' => array('name'=>'priority', 'type'=>'xsd:string'),
'fulldayevent' => array('name'=>'fulldayevent', 'type'=>'xsd:string'),
'location' => array('name'=>'location', 'type'=>'xsd:string'),
'socid' => array('name'=>'socid', 'type'=>'xsd:string'),
'contactid' => array('name'=>'contactid', 'type'=>'xsd:string'),
'projectid' => array('name'=>'projectid', 'type'=>'xsd:string'),
'fk_element' => array('name'=>'fk_element', 'type'=>'xsd:string'),
'elementtype' => array('name'=>'elementtype', 'type'=>'xsd:string'));
'id' => array('name' => 'id', 'type' => 'xsd:string'),
'ref' => array('name' => 'ref', 'type' => 'xsd:string'),
'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'),
'type_id' => array('name' => 'type_id', 'type' => 'xsd:string'),
'type_code' => array('name' => 'type_code', 'type' => 'xsd:string'),
'type' => array('name' => 'type', 'type' => 'xsd:string'),
'label' => array('name' => 'label', 'type' => 'xsd:string'),
'datep' => array('name' => 'datep', 'type' => 'xsd:dateTime'),
'datef' => array('name' => 'datef', 'type' => 'xsd:dateTime'),
'datec' => array('name' => 'datec', 'type' => 'xsd:dateTime'),
'datem' => array('name' => 'datem', 'type' => 'xsd:dateTime'),
'note' => array('name' => 'note', 'type' => 'xsd:string'),
'percentage' => array('name' => 'percentage', 'type' => 'xsd:string'),
'author' => array('name' => 'author', 'type' => 'xsd:string'),
'usermod' => array('name' => 'usermod', 'type' => 'xsd:string'),
'userownerid' => array('name' => 'userownerid', 'type' => 'xsd:string'),
'priority' => array('name' => 'priority', 'type' => 'xsd:string'),
'fulldayevent' => array('name' => 'fulldayevent', 'type' => 'xsd:string'),
'location' => array('name' => 'location', 'type' => 'xsd:string'),
'socid' => array('name' => 'socid', 'type' => 'xsd:string'),
'contactid' => array('name' => 'contactid', 'type' => 'xsd:string'),
'projectid' => array('name' => 'projectid', 'type' => 'xsd:string'),
'fk_element' => array('name' => 'fk_element', 'type' => 'xsd:string'),
'elementtype' => array('name' => 'elementtype', 'type' => 'xsd:string'));
$elementtype = 'actioncomm';
@ -150,7 +151,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie
$type = 'xsd:string';
}
$extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type);
$extrafield_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type);
}
}
if (is_array($extrafield_array)) {
@ -175,8 +176,8 @@ $server->wsdl->addComplexType(
'sequence',
'',
array(
'code' => array('name'=>'code', 'type'=>'xsd:string'),
'libelle' => array('name'=>'libelle', 'type'=>'xsd:string')
'code' => array('name' => 'code', 'type' => 'xsd:string'),
'libelle' => array('name' => 'libelle', 'type' => 'xsd:string')
)
);
@ -209,9 +210,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped
$server->register(
'getListActionCommType',
// Entry values
array('authentication'=>'tns:authentication'),
array('authentication' => 'tns:authentication'),
// Exit values
array('result'=>'tns:result', 'actioncommtypes'=>'tns:actioncommtypes'),
array('result' => 'tns:result', 'actioncommtypes' => 'tns:actioncommtypes'),
$ns,
$ns.'#getListActionCommType',
$styledoc,
@ -223,9 +224,9 @@ $server->register(
$server->register(
'getActionComm',
// Entry values
array('authentication'=>'tns:authentication', 'id'=>'xsd:string'),
array('authentication' => 'tns:authentication', 'id' => 'xsd:string'),
// Exit values
array('result'=>'tns:result', 'actioncomm'=>'tns:actioncomm'),
array('result' => 'tns:result', 'actioncomm' => 'tns:actioncomm'),
$ns,
$ns.'#getActionComm',
$styledoc,
@ -237,9 +238,9 @@ $server->register(
$server->register(
'createActionComm',
// Entry values
array('authentication'=>'tns:authentication', 'actioncomm'=>'tns:actioncomm'),
array('authentication' => 'tns:authentication', 'actioncomm' => 'tns:actioncomm'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string'),
$ns,
$ns.'#createActionComm',
$styledoc,
@ -251,9 +252,9 @@ $server->register(
$server->register(
'updateActionComm',
// Entry values
array('authentication'=>'tns:authentication', 'actioncomm'=>'tns:actioncomm'),
array('authentication' => 'tns:authentication', 'actioncomm' => 'tns:actioncomm'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string'),
$ns,
$ns.'#updateActionComm',
$styledoc,
@ -303,29 +304,29 @@ function getActionComm($authentication, $id)
if ($result > 0) {
$actioncomm_result_fields = array(
'id' => $actioncomm->id,
'ref'=> $actioncomm->ref,
'ref_ext'=> $actioncomm->ref_ext,
'type_id'=> $actioncomm->type_id,
'type_code'=> $actioncomm->type_code,
'type'=> $actioncomm->type,
'label'=> $actioncomm->label,
'datep'=> dol_print_date($actioncomm->datep, 'dayhourrfc'),
'datef'=> dol_print_date($actioncomm->datef, 'dayhourrfc'),
'datec'=> dol_print_date($actioncomm->datec, 'dayhourrfc'),
'datem'=> dol_print_date($actioncomm->datem, 'dayhourrfc'),
'note'=> $actioncomm->note_private,
'percentage'=> $actioncomm->percentage,
'author'=> $actioncomm->authorid,
'usermod'=> $actioncomm->usermodid,
'userownerid'=> $actioncomm->userownerid,
'priority'=> $actioncomm->priority,
'fulldayevent'=> $actioncomm->fulldayevent,
'location'=> $actioncomm->location,
'socid'=> $actioncomm->socid,
'contactid'=> $actioncomm->contact_id,
'projectid'=> $actioncomm->fk_project,
'fk_element'=> $actioncomm->fk_element,
'elementtype'=> $actioncomm->elementtype
'ref' => $actioncomm->ref,
'ref_ext' => $actioncomm->ref_ext,
'type_id' => $actioncomm->type_id,
'type_code' => $actioncomm->type_code,
'type' => $actioncomm->type,
'label' => $actioncomm->label,
'datep' => dol_print_date($actioncomm->datep, 'dayhourrfc'),
'datef' => dol_print_date($actioncomm->datef, 'dayhourrfc'),
'datec' => dol_print_date($actioncomm->datec, 'dayhourrfc'),
'datem' => dol_print_date($actioncomm->datem, 'dayhourrfc'),
'note' => $actioncomm->note_private,
'percentage' => $actioncomm->percentage,
'author' => $actioncomm->authorid,
'usermod' => $actioncomm->usermodid,
'userownerid' => $actioncomm->userownerid,
'priority' => $actioncomm->priority,
'fulldayevent' => $actioncomm->fulldayevent,
'location' => $actioncomm->location,
'socid' => $actioncomm->socid,
'contactid' => $actioncomm->contact_id,
'projectid' => $actioncomm->fk_project,
'fk_element' => $actioncomm->fk_element,
'elementtype' => $actioncomm->elementtype
);
$elementtype = 'actioncomm';
@ -345,8 +346,8 @@ function getActionComm($authentication, $id)
// Create
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'actioncomm'=>$actioncomm_result_fields);
'result' => array('result_code' => 'OK', 'result_label' => ''),
'actioncomm' => $actioncomm_result_fields);
} else {
$error++;
$errorcode = 'NOT_FOUND';
@ -360,7 +361,7 @@ function getActionComm($authentication, $id)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@ -399,12 +400,12 @@ function getListActionCommType($authentication)
if ($result > 0) {
$resultarray = array();
foreach ($cactioncomm->liste_array as $code => $libeller) {
$resultarray[] = array('code'=>$code, 'libelle'=>$libeller);
$resultarray[] = array('code' => $code, 'libelle' => $libeller);
}
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'actioncommtypes'=>$resultarray);
'result' => array('result_code' => 'OK', 'result_label' => ''),
'actioncommtypes' => $resultarray);
} else {
$error++;
$errorcode = 'NOT_FOUND';
@ -418,7 +419,7 @@ function getListActionCommType($authentication)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@ -493,7 +494,7 @@ function createActionComm($authentication, $actioncomm)
if (!$error) {
$db->commit();
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id);
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id);
} else {
$db->rollback();
$error++;
@ -503,7 +504,7 @@ function createActionComm($authentication, $actioncomm)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@ -586,12 +587,13 @@ function updateActionComm($authentication, $actioncomm)
$error++;
}
}
'@phan-var-force array{id:string} $actioncomm';
if ((!$error) && ($objectfound)) {
$db->commit();
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'id'=>$object->id
'result' => array('result_code' => 'OK', 'result_label' => ''),
'id' => $object->id
);
} elseif ($objectfound) {
$db->rollback();
@ -606,7 +608,7 @@ function updateActionComm($authentication, $actioncomm)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;