Skip to content

Commit

Permalink
Qual: Fix notices formsetup...formwebsite.class
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Oct 23, 2024
1 parent 197fd09 commit 1bf94f6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
3 changes: 1 addition & 2 deletions dev/tools/phan/baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ return [
// PhanRedefineFunction : 50+ occurrences
// PhanPluginEmptyStatementIf : 45+ occurrences
// PhanTypeExpectedObjectPropAccess : 40+ occurrences
// PhanPluginUnknownArrayPropertyType : 35+ occurrences
// PhanTypeInvalidDimOffset : 35+ occurrences
// PhanPluginUnknownArrayPropertyType : 30+ occurrences
// PhanTypeMismatchDimFetch : 30+ occurrences
// PhanPluginUnknownObjectMethodCall : 15+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
Expand Down Expand Up @@ -254,7 +254,6 @@ return [
'htdocs/core/class/html.formcompany.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/html.formfile.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/html.formmail.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/html.formsetup.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/core/class/html.formwebsite.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
'htdocs/core/class/ldap.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/class/link.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
Expand Down
20 changes: 10 additions & 10 deletions htdocs/core/class/html.formsetup.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class FormSetup

/**
*
* @var array
* @var array<string,string>
*/
public $formAttributes = array(
'action' => '', // set in __construct
Expand All @@ -76,7 +76,7 @@ class FormSetup

/**
* an list of hidden inputs used only in edit mode
* @var array
* @var array<string,string> Currently array{token:string,action:string}
*/
public $formHiddenInputs = array();

Expand Down Expand Up @@ -116,7 +116,7 @@ public function __construct($db, $outputLangs = null)
/**
* Generate an attributes string form an input array
*
* @param array $attributes an array of attributes keys and values,
* @param array<string,mixed|mixed[]|Object> $attributes an array of attributes keys and values,
* @return string attribute string
*/
public static function generateAttributesStringFromArray($attributes)
Expand Down Expand Up @@ -618,13 +618,13 @@ class FormSetupItem
/** @var string $picto */
public $picto = '';

/** @var string $fieldValue */
/** @var ?string $fieldValue */
public $fieldValue;

/** @var string $defaultFieldValue */
/** @var ?string $defaultFieldValue */
public $defaultFieldValue = null;

/** @var array $fieldAttr fields attribute only for compatible fields like input text */
/** @var array{name?:string,id?:string,value?:mixed,class?:string,disabled?:?int<0,1>,type?:string,size?:int,placeholder?:string,step?:float|string,min?:int,max?:int} fields attribute only for compatible fields like input text */
public $fieldAttr = array();

/** @var bool|string set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too */
Expand All @@ -639,10 +639,10 @@ class FormSetupItem
/** @var int $rank */
public $rank = 0;

/** @var array set this var for options on select and multiselect items */
/** @var array<string,string|array{id:string,label:string,color:string,picto:string,labelhtml:string}> set this var for options on select and multiselect items */
public $fieldOptions = array();

/** @var array set this var to add more parameters */
/** @var array<string,string|int|array{id:string,label:string,color:string,picto:string,labelhtml:string}> set this var to add more parameters */
public $fieldParams = array();

/** @var callable $saveCallBack */
Expand Down Expand Up @@ -1513,7 +1513,7 @@ public function setAsTitle()
/**
* Set type of input as a simple title. No data to store
*
* @param array $fieldOptions A table of field options
* @param array<string,string|array{id:string,label:string,color:string,picto:string,labelhtml:string}> $fieldOptions A table of field options
* @return self
*/
public function setAsMultiSelect($fieldOptions)
Expand All @@ -1529,7 +1529,7 @@ public function setAsMultiSelect($fieldOptions)
/**
* Set type of input as a simple title. No data to store
*
* @param array $fieldOptions A table of field options
* @param array<string,string|array{id:string,label:string,color:string,picto:string,labelhtml:string}> $fieldOptions A table of field options
* @return self
*/
public function setAsSelect($fieldOptions)
Expand Down
12 changes: 8 additions & 4 deletions htdocs/core/class/html.formwebsite.class.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* 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
Expand Down Expand Up @@ -27,6 +28,9 @@
*/
class FormWebsite
{
/**
* @var DoliDB
*/
private $db;

/**
Expand All @@ -35,7 +39,7 @@ class FormWebsite
public $error;

/**
* var int A number of lines
* @var int A number of lines
*/
public $num;

Expand Down Expand Up @@ -251,10 +255,10 @@ public function selectSampleOfContainer($htmlname, $selected = '', $useempty = 0
* @param Website $website Object Website
* @param string $htmlname Name of select zone
* @param int $pageid Preselected container ID
* @param int $showempty Show empty record
* @param int<0,1> $showempty Show empty record
* @param string $action Action on page that use this select list
* @param string $morecss More CSS
* @param array $excludeids Exclude some ID in list
* @param null|string[] $excludeids Exclude some ID in list
* @return string HTML select component with list of block containers
*/
public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '', $morecss = 'minwidth200', $excludeids = null)
Expand Down Expand Up @@ -385,7 +389,7 @@ public function getContentPageTemplate($htmlContent = 'message')

$out .= '<div class="template-option" data-template="'.$template.'" data-content="'.htmlentities($contentHtml).'">';
$out .= '<img class="maillayout" alt="'.$template.'" src="'.DOL_URL_ROOT.'/theme/common/maillayout/'.$template.'.png" />';
$out .= '<span class="template-option-text">'.($template != 'text' ? ucfirst($template) : ucfirst($templateFunction)).'</span>';
$out .= '<span class="template-option-text">'.($template != 'text' ? ucfirst($template) : ucfirst($templateFunction)).'</span>';
$out .= '</div>';
}
$out .= '<input type="hidden" name="sample" value="" />';
Expand Down

0 comments on commit 1bf94f6

Please sign in to comment.