Qual: Fix or ignore functions.lib.php phan notices (#29344)

* Fix: LogHandler parent class, implements interface & provides $code

* Fix: functions.lib phan notices

* Fix phan notifications

* Match expected DebugBar signature - rename getRenderer

* Call the correct renderer method for the DebugBar

* Use correct key type to access array

* Ignore notices

* Update functions.lib.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
MDW
2024-04-14 04:46:33 +02:00
committed by GitHub
parent c13cafab68
commit da9fd874bc
9 changed files with 179 additions and 119 deletions

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*/
/*
* This program is free software; you can redistribute it and/or modify
@@ -22,12 +23,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandlerInterface.php';
/**
* Parent class for log handlers
*/
class LogHandler
abstract class LogHandler implements LogHandlerInterface
{
/**
* @var string Code for the handler
*/
public $code;
protected $ident = 0;
/**
* @var string[] Array of errors messages
* @var string[] Array of error messages
*/
public $errors = [];

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*/
/*
* This program is free software; you can redistribute it and/or modify
@@ -79,10 +80,11 @@ interface LogHandlerInterface
public function isActive();
/**
* Output log content
* Export the message
*
* @param array $content Content to log
* @return void
* @param array $content Array containing the info about the message
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
* @return void
*/
public function export($content);
public function export($content, $suffixinfilename = '');
}

View File

@@ -8,7 +8,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
/**
* Class to manage logging to a file
*/
class mod_syslog_file extends LogHandler implements LogHandlerInterface
class mod_syslog_file extends LogHandler
{
public $code = 'file';
public $lastTime = 0;

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
@@ -7,7 +8,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
/**
* Class to manage logging to syslog
*/
class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
class mod_syslog_syslog extends LogHandler
{
public $code = 'syslog';
@@ -104,10 +105,11 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
/**
* Export the message
*
* @param array $content Array containing the info about the message
* @return void
* @param array $content Array containing the info about the message
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
* @return void
*/
public function export($content)
public function export($content, $suffixinfilename = '')
{
global $conf;