-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32572 from mdeweerd/fix_phan_202408.1
Qual: Improve phpdoc for phan notices
- Loading branch information
Showing
3 changed files
with
18 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
/* Copyright (C) 2000-2007 Rodolphe Quiedeville <[email protected]> | ||
* Copyright (C) 2003 Jean-Louis Bergamo <[email protected]> | ||
* Copyright (C) 2004-2024 Laurent Destailleur <[email protected]> | ||
|
@@ -21,7 +22,7 @@ | |
* Copyright (C) 2022 Ferran Marcet <[email protected]> | ||
* Copyright (C) 2022 Charlene Benke <[email protected]> | ||
* Copyright (C) 2023 Joachim Kueter <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* Copyright (C) 2024 Lenin Rivas <[email protected]> | ||
* Copyright (C) 2024 Josep Lluís Amador Teruel <[email protected]> | ||
* Copyright (C) 2024 Benoît PASCAL <[email protected]> | ||
|
@@ -9686,9 +9687,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, | |
* $mesg = make_substitutions($mesg, $substitutionarray, $langs); | ||
* | ||
* @param string $text Source string in which we must do substitution | ||
* @param array<string,string> $substitutionarray Array with key->val to substitute. Example: array('__MYKEY__' => 'MyVal', ...) | ||
* @param array<string,null|string|float|int> $substitutionarray Array with key->val to substitute. Example: array('__MYKEY__' => 'MyVal', ...) | ||
* @param ?Translate $outputlangs Output language | ||
* @param int $converttextinhtmlifnecessary 0=Convert only value into HTML if text is already in HTML | ||
* @param int<0,1> $converttextinhtmlifnecessary 0=Convert only value into HTML if text is already in HTML | ||
* 1=Will also convert initial $text into HTML if we try to insert one value that is HTML | ||
* @return string Output string after substitutions | ||
* @see complete_substitutions_array(), getCommonSubstitutionArray() | ||
|
@@ -9736,7 +9737,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con | |
$msgishtml = 1; | ||
} | ||
} else { | ||
$value = dol_nl2br("$value"); | ||
$value = dol_nl2br((string) $value); | ||
} | ||
|
||
$text = preg_replace('/__\('.preg_quote($reg[1], '/').'\)__/', $value, $text); | ||
|
@@ -9767,7 +9768,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con | |
$msgishtml = 1; | ||
} | ||
} else { | ||
$value = dol_nl2br("$value"); | ||
$value = dol_nl2br((string) $value); | ||
} | ||
|
||
$text = preg_replace('/__\['.preg_quote($keyfound, '/').'\]__/', $value, $text); | ||
|
@@ -9785,7 +9786,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con | |
} | ||
|
||
if (empty($converttextinhtmlifnecessary)) { | ||
$text = str_replace("$key", "$value", $text); // We must keep the " to work when value is 123.5 for example | ||
$text = str_replace((string) $key, (string) $value, $text); // Cast to string is needed when value is 123.5 for example | ||
} else { | ||
if (! $msgishtml) { | ||
$valueishtml = dol_textishtml($value, 1); | ||
|
@@ -9795,9 +9796,9 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con | |
$msgishtml = 1; | ||
} | ||
} else { | ||
$value = dol_nl2br("$value"); | ||
$value = dol_nl2br((string) $value); | ||
} | ||
$text = str_replace("$key", "$value", $text); // We must keep the " to work when value is 123.5 for example | ||
$text = str_replace((string) $key, (string) $value, $text); // Cast to string is needed 123.5 for example | ||
} | ||
} | ||
|
||
|
@@ -9820,7 +9821,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con | |
if (isset($lazy_load_arr[1]) && !empty($lazy_load_arr[1])) { | ||
$key_to_substitute = $lazy_load_arr[1]; | ||
if (preg_match('/' . preg_quote($key_to_substitute, '/') . '/', $text)) { | ||
$param_arr = explode(':', $value); | ||
$param_arr = explode(':', (string) $value); | ||
// path:class:method:id | ||
if (count($param_arr) == 4) { | ||
$path = $param_arr[0]; | ||
|
@@ -9855,7 +9856,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con | |
$valuetouseforsubstitution = $tmpobj->$method($id, $key_to_substitute, true); | ||
} | ||
|
||
$text = str_replace("$key_to_substitute", "$valuetouseforsubstitution", $text); // We must keep the " to work when value is 123.5 for example | ||
$text = str_replace((string) $key_to_substitute, (string) $valuetouseforsubstitution, $text); // Cast to string in case value is 123.5 for example | ||
} | ||
} | ||
} | ||
|
@@ -10665,9 +10666,9 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1' | |
// Check if there is dynamic call (first we use black list patterns) | ||
if (preg_match('/\$[\w]*\s*\(/', $s)) { | ||
if ($returnvalue) { | ||
return 'Bad string syntax to evaluate (mode '.$onlysimplestring.', found a call using of "$abc(" or "$abc (" instead of using the direct name of the function): '.$s; | ||
return 'Bad string syntax to evaluate (mode '.$onlysimplestring.', found a call using "$abc(" or "$abc (" instead of using the direct name of the function): '.$s; | ||
} else { | ||
dol_syslog('Bad string syntax to evaluate (mode '.$onlysimplestring.', found a call using of "$abc(" or "$abc (" instead of using the direct name of the function): '.$s, LOG_WARNING); | ||
dol_syslog('Bad string syntax to evaluate (mode '.$onlysimplestring.', found a call using "$abc(" or "$abc (" instead of using the direct name of the function): '.$s, LOG_WARNING); | ||
return ''; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters