Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix phpstan #31199

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d79c165
fix phpstan
frederic34 Sep 30, 2024
03b738b
fix phpstan
frederic34 Sep 30, 2024
6ceab7c
Merge remote-tracking branch 'upstream/develop' into fix/ignored_phps…
frederic34 Sep 30, 2024
8622c23
fix phpstan
frederic34 Sep 30, 2024
36384af
fix phpstan
frederic34 Sep 30, 2024
e6dadd6
Merge remote-tracking branch 'upstream/develop' into fix/ignored_phps…
frederic34 Sep 30, 2024
5a01ffc
fix phpstan
frederic34 Sep 30, 2024
d1177f3
fix phpstan
frederic34 Sep 30, 2024
3fe25ee
fix phpstan
frederic34 Sep 30, 2024
b40b889
fix phpstan
frederic34 Sep 30, 2024
02a8a07
fix phpstan
frederic34 Sep 30, 2024
34c5f22
fix phpstan
frederic34 Sep 30, 2024
a7204aa
fix phpstan
frederic34 Sep 30, 2024
2cc6b2f
fix phpstan
frederic34 Sep 30, 2024
04531a7
Merge branch 'develop' into fix/ignored_phpstan_61
frederic34 Sep 30, 2024
942896f
Merge branch 'develop' into fix/ignored_phpstan_61
frederic34 Oct 1, 2024
f7249e2
Merge remote-tracking branch 'upstream/develop' into fix/ignored_phps…
frederic34 Oct 1, 2024
34c2678
Merge branch 'develop' into fix/ignored_phpstan_61
frederic34 Oct 1, 2024
19cbcc4
Merge branch 'develop' into fix/ignored_phpstan_61
frederic34 Oct 3, 2024
e36f9e3
Merge remote-tracking branch 'upstream/develop' into fix/ignored_phps…
frederic34 Oct 7, 2024
4ccfb29
Merge remote-tracking branch 'origin/fix/ignored_phpstan_61' into fix…
frederic34 Oct 7, 2024
e24b763
Merge branch 'develop' into fix/ignored_phpstan_61
frederic34 Oct 8, 2024
3c876ec
fix phpstan
frederic34 Oct 8, 2024
2aa2d78
fix phpstan
frederic34 Oct 8, 2024
79e7d3c
fix phpstan
frederic34 Oct 8, 2024
4bd97ed
fix phpstan
frederic34 Oct 8, 2024
eaa4580
fix phpstan
frederic34 Oct 8, 2024
1cad4de
fix phpstan
frederic34 Oct 8, 2024
4a64968
fix phpstan
frederic34 Oct 8, 2024
546db3a
Merge remote-tracking branch 'upstream/develop' into fix/ignored_phps…
frederic34 Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions htdocs/api/class/api_documents.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,18 +631,17 @@ public function getDocumentsListByElement($modulepart, $id = 0, $ref = '', $sort
}


/**
* Return a document.
*
* @param int $id ID of document
* @return array Array with data of file
*
* @throws RestException
*/
/*
public function get($id) {
return array('note'=>'xxx');
}*/
// /**
// * Return a document.
// *
// * @param int $id ID of document
// * @return array Array with data of file
// *
// * @throws RestException
// */
// public function get($id) {
// return array('note'=>'xxx');
// }


/**
Expand Down
2 changes: 1 addition & 1 deletion htdocs/bom/class/bomline.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class BOMLine extends CommonObjectLine
public $description;

/**
* @var double qty
* @var float qty
*/
public $qty;

Expand Down
4 changes: 2 additions & 2 deletions htdocs/compta/facture/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,7 @@
if (is_array($lines)) {
foreach ($lines as $line) {
// We keep ->subprice and ->pa_ht, but we change the qty
$line->qty = price2num((float) $line->qty * (float) $valuestandardinvoice / 100, 'MS');
$line->qty = (float) price2num((float) $line->qty * (float) $valuestandardinvoice / 100, 'MS');
}
}
}
Expand All @@ -1725,7 +1725,7 @@
if (is_array($lines)) {
foreach ($lines as $line) {
// We keep ->subprice and ->pa_ht, but we change the qty
$line->qty = price2num((float) $line->qty * (float) $valuedeposit / 100, 'MS');
$line->qty = (float) price2num((float) $line->qty * (float) $valuedeposit / 100, 'MS');
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions htdocs/core/class/commondocgenerator.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1477,10 +1477,10 @@ public function getExtrafieldContent($object, $extrafieldKey, $outputlangs = nul
/**
* display extrafields columns content
*
* @param CommonObjectLine $object line of common object
* @param Translate $outputlangs Output language
* @param array<string,mixed> $params array of additional parameters
* @return string Html string
* @param CommonObject|CommonObjectLine $object line of common object
* @param Translate $outputlangs Output language
* @param array<string,mixed> $params array of additional parameters
* @return string Html string
*/
public function getExtrafieldsInHtml($object, $outputlangs, $params = array())
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/commoninvoice.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1940,7 +1940,7 @@ abstract class CommonInvoiceLine extends CommonObjectLine

/**
* Quantity
* @var double
* @var float
*/
public $qty;

Expand Down
9 changes: 7 additions & 2 deletions htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ abstract class CommonObject


/**
* @var CommonObjectLine[]|CommonObject[]|stdClass[]
* @var CommonObjectLine[]
*/
public $lines;

Expand Down Expand Up @@ -866,6 +866,11 @@ abstract class CommonObject
*/
public $isextrafieldmanaged = 0;

/**
* @var int pagebreak
*/
public $pagebreak;


// No constructor as it is an abstract class

Expand Down Expand Up @@ -5278,7 +5283,7 @@ public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateS
* TODO Move this into an output class file (htmlline.class.php)
*
* @param string $action GET/POST action
* @param CommonObjectLine $line Selected object line to output
* @param CommonObjectLine $line Selected object line to output
* @param '' $var Not used
* @param int $num Number of line (0)
* @param int $i I
Expand Down
68 changes: 29 additions & 39 deletions htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,30 +530,20 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
);
$reshook = $hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook


$sign = 1;
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
if ($prev_progress > 0 && !empty($object->lines[$i]->situation_percent)) { // Compute progress from previous situation
if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) {
$tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
} else {
$tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
}
if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) {
$tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva;
} else {
if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) {
$tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva;
} else {
$tvaligne = $sign * $object->lines[$i]->total_tva;
}
$tvaligne = $sign * $object->lines[$i]->total_tva;
}

$localtax1ligne = $object->lines[$i]->total_localtax1;
$localtax2ligne = $object->lines[$i]->total_localtax2;
$localtax1_rate = $object->lines[$i]->localtax1_tx;
$localtax2_rate = $object->lines[$i]->localtax2_tx;
$localtax1_type = $object->lines[$i]->localtax1_type;
$localtax2_type = $object->lines[$i]->localtax2_type;
// $localtax1ligne = $object->lines[$i]->total_localtax1;
// $localtax2ligne = $object->lines[$i]->total_localtax2;
// $localtax1_rate = $object->lines[$i]->localtax1_tx;
// $localtax2_rate = $object->lines[$i]->localtax2_tx;
// $localtax1_type = $object->lines[$i]->localtax1_type;
// $localtax2_type = $object->lines[$i]->localtax2_type;

// TODO remise_percent is an obsolete field for object parent
/*if ($object->remise_percent) {
Expand All @@ -569,28 +559,28 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
$vatrate = (string) $object->lines[$i]->tva_tx;

// Retrieve type from database for backward compatibility with old records
if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined
&& (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax
$localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc);
$localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : '';
$localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : '';
}
// if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined
// && (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax
// $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc);
// $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : '';
// $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : '';
// }

// retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0) {
if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
$this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
} else {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
}
}
if ($localtax2_type && $localtax2ligne != 0) {
if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
$this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
} else {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
}
}
// if ($localtax1_type && $localtax1ligne != 0) {
// if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
// $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
// } else {
// $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
// }
// }
// if ($localtax2_type && $localtax2ligne != 0) {
// if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
// $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
// } else {
// $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
// }
// }

if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
$vatrate .= '*';
Expand Down
31 changes: 27 additions & 4 deletions htdocs/ecm/class/ecmfiles.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

// Put here all includes required by your class file
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';

require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
/**
* Class to manage ECM files
*/
Expand Down Expand Up @@ -156,6 +156,11 @@ class EcmFiles extends CommonObject
*/
public $section_id;

/**
* @var EcmFilesLine[]
*/
public $lines;

public $fields = array(
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"),
'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => -1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1, 'comment' => "contains hash from filename+filepath"),
Expand Down Expand Up @@ -613,7 +618,7 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset =
$num = $this->db->num_rows($resql);

while ($obj = $this->db->fetch_object($resql)) {
$line = new EcmFilesLine();
$line = new EcmFilesLine($this->db);

$line->id = $obj->rowid;
$line->ref = $obj->rowid;
Expand Down Expand Up @@ -1002,7 +1007,7 @@ public static function LibStatut($status, $mode = 0)
*/
public function initAsSpecimen()
{
global $conf, $user;
global $user;

$this->id = 0;
$this->specimen = 1;
Expand Down Expand Up @@ -1033,7 +1038,7 @@ public function initAsSpecimen()
/**
* Class of an index line of a document
*/
class EcmFilesLine
class EcmFilesLine extends CommonObjectLine
{
/**
* @var string ECM files line label
Expand All @@ -1045,17 +1050,35 @@ class EcmFilesLine
*/
public $entity;

/**
* @var string filename
*/
public $filename;

/**
* @var string filepath
*/
public $filepath;

/**
* @var string fullpath origin
*/
public $fullpath_orig;

/**
* @var string description
*/
public $description;

/**
* @var string keywords
*/
public $keywords;
public $cover;

/**
* @var int position
*/
public $position;
public $gen_or_uploaded; // can be 'generated', 'uploaded', 'unknown'
public $extraparams;
Expand Down
58 changes: 49 additions & 9 deletions htdocs/projet/class/task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ class Task extends CommonObjectLine
*/
public $project_budget_amount;

/**
* @var TaskLine[]
*/
public $lines;

/**
* Draft status
*/
Expand Down Expand Up @@ -1684,25 +1689,25 @@ public function fetchTimeSpentOnTask($morewherefilter = '')
while ($i < $num) {
$obj = $this->db->fetch_object($resql);

$newobj = new stdClass();
$newobj = new TaskLine($this->db);

$newobj->socid = $obj->socid;
$newobj->thirdparty_name = $obj->thirdparty_name;
$newobj->thirdparty_email = $obj->thirdparty_email;
$newobj->socid = $obj->socid;
$newobj->thirdparty_name = $obj->thirdparty_name;
$newobj->thirdparty_email = $obj->thirdparty_email;

$newobj->fk_project = $obj->project_id;
$newobj->project_ref = $obj->project_ref;
$newobj->fk_project = $obj->project_id;
$newobj->project_ref = $obj->project_ref;
$newobj->project_label = $obj->project_label;
$newobj->public = $obj->project_public;
$newobj->public = $obj->project_public;

$newobj->fk_task = $obj->task_id;
$newobj->fk_task = $obj->task_id;
$newobj->task_ref = $obj->task_ref;
$newobj->task_label = $obj->task_label;

$newobj->timespent_line_id = $obj->rowid;
$newobj->timespent_line_ref_ext = $obj->ref_ext;
$newobj->timespent_line_date = $this->db->jdate($obj->task_date);
$newobj->timespent_line_datehour = $this->db->jdate($obj->task_datehour);
$newobj->timespent_line_datehour = $this->db->jdate($obj->task_datehour);
$newobj->timespent_line_withhour = $obj->task_date_withhour;
$newobj->timespent_line_duration = $obj->task_duration;
$newobj->timespent_line_fk_user = $obj->fk_user;
Expand Down Expand Up @@ -2808,3 +2813,38 @@ public function mergeTask($task_origin_id)
return -1;
}
}

/**
* Class to manage tasks
*/
class TaskLine extends CommonObjectLine
{
public $socid;
public $thirdparty_name;
public $thirdparty_email;

/**
* @var string Ref project
*/
public $project_ref;

/**
* @var string Label project
*/
public $project_label;
public $public;

public $fk_task;
public $task_ref;
public $task_label;

public $timespent_line_id;
public $timespent_line_ref_ext;
public $timespent_line_date;
public $timespent_line_datehour;
public $timespent_line_withhour;
public $timespent_line_duration;
public $timespent_line_fk_user;
public $timespent_line_thm; // hourly rate
public $timespent_line_note;
}
4 changes: 4 additions & 0 deletions htdocs/supplier_proposal/class/supplier_proposal.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ class SupplierProposal extends CommonObject
* @var array<string,string> (Encoded as JSON in database)
*/
public $extraparams = array();

/**
* @var SupplierProposalLine[]
*/
public $lines = array();
public $line;

Expand Down
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ parameters:
- '# (?:salaries_prepare_head) expects Paiement#'
- '# (?:pg_(?:affected_rows|f(?:etch_(?:array|object|row)|ree_result)|num_rows)) expects PgSql\\Result#'
- '# (?:Holiday::getNextNumRef\(\)|get_localtax|pdf_pagefoot|societe_prepare_head) expects Societe#'
- '# (?:Common(?:DocGenerator::get(?:(?:ExtrafieldsInHtml|_substitutionarray_lines)\(\))|Object::printO(?:(?:bject|rigin)Line\(\)))) expects CommonObjectLine#'
- '#colorHexToHsl expects float\|false, true#'
- '#function dolGetButtonAction expects array\{confirm\?: array.*confirm: true} given.#'

Expand Down
Loading