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

clean code and phpdoc #28773

Merged
merged 27 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion htdocs/core/class/commonnumrefgenerator.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function info($langs)
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/modules/asset/mod_asset_standard.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022-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
Expand Down Expand Up @@ -78,10 +78,10 @@
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param Asset $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)

Check warning on line 84 in htdocs/core/modules/asset/mod_asset_standard.php

View workflow job for this annotation

GitHub Actions / Run phan

mod_asset_standard.php: PhanParamSignatureMismatch: Declaration of function canBeActivated(\Asset $object) : bool should be compatible with function canBeActivated(\CommonObject $object) : bool defined in htdocs/core/class/commonnumrefgenerator.class.php:138 (Expected \Asset $object to have the same type as \CommonObject $object or a supertype)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdeweerd phan warning here

{
global $conf, $langs, $db;

Expand Down Expand Up @@ -118,7 +118,7 @@
/**
* Return next free value
*
* @param Object $object Object we need next value for
* @param Asset $object Object we need next value for
* @return string|-1 Next value if OK, -1 if KO
*/
public function getNextValue($object)
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/barcode/mod_barcode_product_standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public function getExample($langs, $objproduct = 0)
/**
* Return literal barcode type code from numerical rowid type of barcode
*
* @param Database $db Database
* @param int $type Type of barcode (EAN, ISBN, ...) as rowid
* @param DoliDB $db Database
* @param int $type Type of barcode (EAN, ISBN, ...) as rowid
* @return string
*/
public function literalBarcodeType($db, $type = 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function getExample($langs, $objthirdparty = 0)
/**
* Return literal barcode type code from numerical rowid type of barcode
*
* @param Database $db Database
* @param DoliDB $db Database
* @param int $type Type of barcode (EAN, ISBN, ...) as rowid
* @return string
*/
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/bom/mod_bom_advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <[email protected]>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-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
Expand Down Expand Up @@ -119,7 +119,7 @@ public function getExample()
* Return next free value
*
* @param Product $objprod Object product
* @param Object $object Object we need next value for
* @param Bom $object Object we need next value for
* @return string|0 Next value if OK, 0 if KO
*/
public function getNextValue($objprod, $object)
Expand Down
11 changes: 6 additions & 5 deletions htdocs/core/modules/bom/mod_bom_standard.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2024 Frédéric France <[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 @@ -76,10 +77,10 @@
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param Bom $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)

Check warning on line 83 in htdocs/core/modules/bom/mod_bom_standard.php

View workflow job for this annotation

GitHub Actions / Run phan

mod_bom_standard.php: PhanParamSignatureMismatch: Declaration of function canBeActivated(\BOM $object) : bool should be compatible with function canBeActivated(\CommonObject $object) : bool defined in htdocs/core/class/commonnumrefgenerator.class.php:138 (Expected \BOM $object to have the same type as \CommonObject $object or a supertype)
{
global $conf, $langs, $db;

Expand Down Expand Up @@ -112,9 +113,9 @@
/**
* Return next free value
*
* @param Product $objprod Object product
* @param Object $object Object we need next value for
* @return string|-1 Next value if OK, -1 if KO
* @param Product $objprod Object product
* @param Bom $object Object we need next value for
* @return string|-1 Next value if OK, -1 if KO
*/
public function getNextValue($objprod, $object)
{
Expand Down
18 changes: 2 additions & 16 deletions htdocs/core/modules/cheque/mod_chequereceipt_mint.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2015 Juanjo Menent <[email protected]>
* Copyright (C) 2024 Frédéric France <[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 @@ -73,10 +74,10 @@
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param RemiseCheque $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)

Check warning on line 80 in htdocs/core/modules/cheque/mod_chequereceipt_mint.php

View workflow job for this annotation

GitHub Actions / Run phan

mod_chequereceipt_mint.php: PhanParamSignatureMismatch: Declaration of function canBeActivated(\RemiseCheque $object) : bool should be compatible with function canBeActivated(\CommonObject $object) : bool defined in htdocs/core/class/commonnumrefgenerator.class.php:138 (Expected \RemiseCheque $object to have the same type as \CommonObject $object or a supertype)
{
global $conf, $langs, $db;

Expand Down Expand Up @@ -150,19 +151,4 @@
dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @return string Next free value
*/
public function chequereceipt_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}
17 changes: 1 addition & 16 deletions htdocs/core/modules/cheque/mod_chequereceipt_thyme.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2015 Juanjo Menent <[email protected]>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-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
Expand Down Expand Up @@ -131,19 +131,4 @@ public function getNextValue($objsoc, $object)

return $numFinal;
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @return string Next free value
*/
public function chequereceipt_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}
20 changes: 3 additions & 17 deletions htdocs/core/modules/commande/mod_commande_marbre.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2024 Frédéric France <[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 @@ -88,10 +89,10 @@
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param Commande $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)

Check warning on line 95 in htdocs/core/modules/commande/mod_commande_marbre.php

View workflow job for this annotation

GitHub Actions / Run phan

mod_commande_marbre.php: PhanParamSignatureMismatch: Declaration of function canBeActivated(\Commande $object) : bool should be compatible with function canBeActivated(\CommonObject $object) : bool defined in htdocs/core/class/commonnumrefgenerator.class.php:138 (Expected \Commande $object to have the same type as \CommonObject $object or a supertype)
{
global $conf, $langs, $db;

Expand Down Expand Up @@ -125,7 +126,7 @@
* Return next free value
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @param Commande $object Object we need next value for
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($objsoc, $object)
Expand Down Expand Up @@ -165,19 +166,4 @@
dol_syslog("mod_commande_marbre::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @return string|-1 Next free value, -1 if KO
*/
public function commande_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}
19 changes: 2 additions & 17 deletions htdocs/core/modules/commande/mod_commande_saphir.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2009 Regis Houssin <[email protected]>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <[email protected]>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-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
Expand Down Expand Up @@ -119,7 +119,7 @@ public function getExample()
* Return next free value
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @param Commande $object Object we need next value for
* @return string|0 Next value if OK, 0 if KO
*/
public function getNextValue($objsoc, $object)
Expand Down Expand Up @@ -149,19 +149,4 @@ public function getNextValue($objsoc, $object)

return $numFinal;
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @return string Next free value
*/
public function commande_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}
16 changes: 1 addition & 15 deletions htdocs/core/modules/contract/mod_contract_magre.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function getExample()
* Return next value
*
* @param Societe $objsoc third party object
* @param Object $contract contract object
* @param Contrat $contract contract object
* @return string|0 Next value if OK, 0 if KO
*/
public function getNextValue($objsoc, $contract)
Expand All @@ -125,18 +125,4 @@ public function getNextValue($objsoc, $contract)

return $numFinal;
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next value
*
* @param Societe $objsoc third party object
* @param Object $objforref contract object
* @return string|0 Value if OK, 0 if KO
*/
public function contract_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}
19 changes: 2 additions & 17 deletions htdocs/core/modules/contract/mod_contract_serpis.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@
/**
* Test if existing numbers make problems with numbering
*
* @param Object $object Object we need next value for
* @param Contrat $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)

Check warning on line 82 in htdocs/core/modules/contract/mod_contract_serpis.php

View workflow job for this annotation

GitHub Actions / Run phan

mod_contract_serpis.php: PhanParamSignatureMismatch: Declaration of function canBeActivated(\Contrat $object) : bool should be compatible with function canBeActivated(\CommonObject $object) : bool defined in htdocs/core/class/commonnumrefgenerator.class.php:138 (Expected \Contrat $object to have the same type as \CommonObject $object or a supertype)
{
global $conf, $langs, $db;

Expand Down Expand Up @@ -113,7 +113,7 @@
* Return next value
*
* @param Societe $objsoc third party object
* @param Object $contract contract object
* @param Contrat $contract contract object
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($objsoc, $contract)
Expand Down Expand Up @@ -151,19 +151,4 @@
dol_syslog("mod_contract_serpis::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next value
*
* @param Societe $objsoc third party object
* @param Object $objforref contract object
* @return string|-1 Value if OK, -1 if KO
*/
public function contract_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}
20 changes: 3 additions & 17 deletions htdocs/core/modules/delivery/mod_delivery_jade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <[email protected]>
* Copyright (C) 2004-2008 Laurent Destailleur <[email protected]>
* Copyright (C) 2005-2010 Regis Houssin <[email protected]>
* Copyright (C) 2024 Frédéric France <[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 @@ -86,10 +87,10 @@
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param Delivery $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)

Check warning on line 93 in htdocs/core/modules/delivery/mod_delivery_jade.php

View workflow job for this annotation

GitHub Actions / Run phan

mod_delivery_jade.php: PhanParamSignatureMismatch: Declaration of function canBeActivated(\Delivery $object) : bool should be compatible with function canBeActivated(\CommonObject $object) : bool defined in htdocs/core/class/commonnumrefgenerator.class.php:138 (Expected \Delivery $object to have the same type as \CommonObject $object or a supertype)
{
global $langs, $conf, $db;

Expand Down Expand Up @@ -126,7 +127,7 @@
* Return next free value
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @param Delivery $object Object we need next value for
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($objsoc, $object)
Expand Down Expand Up @@ -168,19 +169,4 @@
dol_syslog("mod_delivery_jade::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free ref
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object livraison
* @return string|-1 Value if OK, -1 if KO
*/
public function delivery_get_num($objsoc = 0, $object = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $object);
}
}
Loading
Loading