mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-07 18:58:44 +02:00
N°3129 PHP 8.0 compat : code review modifications
Many thanks @Molkobain & @Hipska !
This commit is contained in:
@@ -324,8 +324,10 @@ class DisplayBlock
|
||||
* @throws DictExceptionMissingString
|
||||
* @throws MySQLException
|
||||
* @throws Exception
|
||||
*
|
||||
* @since 2.7.7 3.0.1 3.1.0 N°3129 add type hinting to $aExtraParams
|
||||
*/
|
||||
public function GetRenderContent(WebPage $oPage, $aExtraParams, $sId)
|
||||
public function GetRenderContent(WebPage $oPage, array $aExtraParams, $sId)
|
||||
{
|
||||
$sHtml = '';
|
||||
// Add the extra params into the filter if they make sense for such a filter
|
||||
@@ -1433,9 +1435,10 @@ class HistoryBlock extends DisplayBlock
|
||||
* @throws \MySQLException
|
||||
* @throws \MySQLHasGoneAwayException
|
||||
*
|
||||
* @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value for $aExtraParams for PHP 8.0 compatibility (var is unused, and all calls were already made using a default value)
|
||||
* @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value for $aExtraParams and add type hinting for PHP 8.0 compatibility
|
||||
* (var is unused, and all calls were already made using a default value)
|
||||
*/
|
||||
public function GetRenderContent(WebPage $oPage, $aExtraParams, $sId)
|
||||
public function GetRenderContent(WebPage $oPage, array $aExtraParams, $sId)
|
||||
{
|
||||
$sHtml = '';
|
||||
$bTruncated = false;
|
||||
@@ -1575,14 +1578,10 @@ class MenuBlock extends DisplayBlock
|
||||
* @throws \MissingQueryArgument
|
||||
* @throws \MySQLException
|
||||
*
|
||||
* @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value for $aExtraParams for PHP 8.0 compatibility (added a test at function start to handle wrong values)
|
||||
* @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value and add type hinting on $aExtraParams for PHP 8.0 compatibility
|
||||
*/
|
||||
public function GetRenderContent(WebPage $oPage, $aExtraParams, $sId)
|
||||
public function GetRenderContent(WebPage $oPage, array $aExtraParams, $sId)
|
||||
{
|
||||
if (empty($aExtraParams)) {
|
||||
$aExtraParams = [];
|
||||
}
|
||||
|
||||
if ($this->m_sStyle == 'popup') // popup is a synonym of 'list' for backward compatibility
|
||||
{
|
||||
$this->m_sStyle = 'list';
|
||||
|
||||
@@ -431,7 +431,7 @@ EOF
|
||||
* @throws CoreException
|
||||
* @throws OQLException
|
||||
*
|
||||
* @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value for $oObj for PHP 8.0 compatibility (a null default value is awkward ?!??)
|
||||
* @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value for $oObj for PHP 8.0 compatibility
|
||||
*/
|
||||
public function AutoComplete(WebPage $oP, $sFilter, $oObj, $sContains, $sOutputFormat = self::ENUM_OUTPUT_FORMAT_CSV, $sOperation = null)
|
||||
{
|
||||
|
||||
@@ -2161,7 +2161,7 @@ class MFElement extends Combodo\iTop\DesignElement
|
||||
EOF;
|
||||
throw new MFException($sExceptionMessage, MFException::COULD_NOT_BE_ADDED, $iLine, $sPath);
|
||||
}
|
||||
$oExisting->MFReplaceWith($oNode);
|
||||
$oExisting->ReplaceWithSingleNode($oNode);
|
||||
$sFlag = 'replaced';
|
||||
}
|
||||
else
|
||||
@@ -2208,7 +2208,7 @@ EOF;
|
||||
throw new MFException($sPath." at line $iLine: could not be modified (marked as deleted)",
|
||||
MFException::COULD_NOT_BE_MODIFIED_ALREADY_DELETED, $sPath, $iLine);
|
||||
}
|
||||
$oExisting->MFReplaceWith($oNode);
|
||||
$oExisting->ReplaceWithSingleNode($oNode);
|
||||
if (!$this->IsInDefinition())
|
||||
{
|
||||
if ($sPrevFlag == '')
|
||||
@@ -2253,7 +2253,7 @@ EOF;
|
||||
{
|
||||
$sFlag = $sPrevFlag; // added, replaced or ''
|
||||
}
|
||||
$oExisting->MFReplaceWith($oNode);
|
||||
$oExisting->ReplaceWithSingleNode($oNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2298,7 +2298,7 @@ EOF;
|
||||
* @since 2.7.7 3.0.1 3.1.0 N°3129 rename method (from `ReplaceWith` to `MFReplaceWith`) to avoid collision with parent `\DOMElement::replaceWith` method (different method modifier and parameters :
|
||||
* throws fatal error in PHP 8.0)
|
||||
*/
|
||||
protected function MFReplaceWith($oNewNode)
|
||||
protected function ReplaceWithSingleNode($oNewNode)
|
||||
{
|
||||
// Move the classes from the old node into the new one
|
||||
if ($this->IsClassNode())
|
||||
|
||||
Reference in New Issue
Block a user