Qual: added deprecation hinting

Added deprecation hinting for class properties
Added syslog warning events for deprecated functions, methods and/or their parameters
Added hinting for some constants
This commit is contained in:
Raphaël Doursenaud
2015-04-23 23:21:06 +02:00
parent e9687cbc4f
commit 3f9270ea78
57 changed files with 626 additions and 114 deletions

View File

@@ -45,10 +45,13 @@ include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php';
* @param string $class Class name
* @param string $member Name of property
* @return mixed Return value of static property
* @deprecated Dolibarr now requires 5.3.0+
* @deprecated Dolibarr now requires 5.3.0+, use $class::$property syntax
* @see https://php.net/manual/language.oop5.static.php
*/
function getStaticMember($class, $member)
{
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
// This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member
/*if (version_compare(phpversion(), '5.3.0', '<'))
{
@@ -387,11 +390,12 @@ function dol_buildpath($path, $type=0)
*
* @param object $object Object to clone
* @return object Object clone
* @deprecated Dolibarr no longer supports PHP4, you can now use native function
* @deprecated Dolibarr no longer supports PHP4, use PHP5 native clone construct
* @see https://php.net/manual/language.oop5.cloning.php
*/
function dol_clone($object)
{
dol_syslog("Functions.lib::dol_clone Clone object");
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
$myclone=clone($object);
return $myclone;
@@ -1702,11 +1706,15 @@ function dol_substr($string,$start,$length,$stringencoding='')
* @param string $url Param to add an url to click values
* @return void
* @deprecated
* @see DolGraph
*/
function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='')
{
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
global $conf,$langs;
global $theme_datacolor; // To have var kept when function is called several times
if (empty($conf->use_javascript_ajax)) return;
$jsgraphlib='flot';
$datacolor=array();
@@ -2380,9 +2388,12 @@ function img_mime($file, $titlealt = '')
* @param int $option Option
* @return string Return img tag
* @deprecated
* @see img_picto
*/
function img_phone($titlealt = 'default', $option = 0)
{
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
global $conf,$langs;
if ($titlealt == 'default') $titlealt = $langs->trans('Call');
@@ -2702,9 +2713,12 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
* @param string $title Title to show
* @return string Title to show
* @deprecated Use print_fiche_titre instead
* @see print_fiche_titre
*/
function print_titre($title)
{
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
print '<div class="titre">'.$title.'</div>';
}
@@ -4059,9 +4073,12 @@ function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
*
* @return float Time (millisecondes) with microsecondes in decimal part
* @deprecated Dolibarr does not support PHP4, you should use native function
* @see microtime()
*/
function dol_microtime_float()
{
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
return microtime(true);
}
@@ -4281,6 +4298,8 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
*/
function setEventMessage($mesgs, $style='mesgs')
{
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
if (! is_array($mesgs)) // If mesgs is a string
{
if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs;