More params and returns to PHP 7.3+

This commit is contained in:
djmaze 2020-03-16 13:08:53 +01:00
parent 3d246ae842
commit 26c38b3ec9
95 changed files with 1028 additions and 4865 deletions

View file

@ -29,8 +29,6 @@ class Callback extends \MailSo\Log\Driver
private $fClearCallback;
/**
* @access protected
*
* @param mixed $fWriteCallback
* @param mixed $fClearCallback
*/
@ -45,20 +43,13 @@ class Callback extends \MailSo\Log\Driver
/**
* @param mixed $fWriteCallback
* @param mixed $fClearCallback = null
*
* @return \MailSo\Log\Drivers\Callback
*/
public static function NewInstance($fWriteCallback, $fClearCallback = null)
public static function NewInstance($fWriteCallback, $fClearCallback = null) : \MailSo\Log\Drivers\Callback
{
return new self($fWriteCallback, $fClearCallback);
}
/**
* @param string|array $mDesc
*
* @return bool
*/
protected function writeImplementation($mDesc)
protected function writeImplementation($mDesc) : bool
{
if ($this->fWriteCallback)
{
@ -68,10 +59,7 @@ class Callback extends \MailSo\Log\Driver
return true;
}
/**
* @return bool
*/
protected function clearImplementation()
protected function clearImplementation() : bool
{
if ($this->fClearCallback)
{

View file

@ -23,12 +23,6 @@ class File extends \MailSo\Log\Driver
*/
private $sLoggerFileName;
/**
* @access protected
*
* @param string $sLoggerFileName
* @param string $sNewLine = "\r\n"
*/
protected function __construct($sLoggerFileName, $sNewLine = "\r\n")
{
parent::__construct();
@ -37,49 +31,27 @@ class File extends \MailSo\Log\Driver
$this->sNewLine = $sNewLine;
}
/**
* @param string $sLoggerFileName
*/
public function SetLoggerFileName($sLoggerFileName)
public function SetLoggerFileName(string $sLoggerFileName)
{
$this->sLoggerFileName = $sLoggerFileName;
}
/**
* @param string $sLoggerFileName
* @param string $sNewLine = "\r\n"
*
* @return \MailSo\Log\Drivers\File
*/
public static function NewInstance($sLoggerFileName, $sNewLine = "\r\n")
public static function NewInstance(string $sLoggerFileName, string $sNewLine = "\r\n") : \MailSo\Log\Drivers\File
{
return new self($sLoggerFileName, $sNewLine);
}
/**
* @param string|array $mDesc
*
* @return bool
*/
protected function writeImplementation($mDesc)
protected function writeImplementation($mDesc) : bool
{
return $this->writeToLogFile($mDesc);
}
/**
* @return bool
*/
protected function clearImplementation()
protected function clearImplementation() : bool
{
return \unlink($this->sLoggerFileName);
}
/**
* @param string|array $mDesc
*
* @return bool
*/
private function writeToLogFile($mDesc)
private function writeToLogFile($mDesc) : bool
{
if (\is_array($mDesc))
{

View file

@ -23,12 +23,6 @@ class Inline extends \MailSo\Log\Driver
*/
private $bHtmlEncodeSpecialChars;
/**
* @access protected
*
* @param string $sNewLine = "\r\n"
* @param bool $bHtmlEncodeSpecialChars = false
*/
protected function __construct($sNewLine = "\r\n", $bHtmlEncodeSpecialChars = false)
{
parent::__construct();
@ -37,23 +31,12 @@ class Inline extends \MailSo\Log\Driver
$this->bHtmlEncodeSpecialChars = $bHtmlEncodeSpecialChars;
}
/**
* @param string $sNewLine = "\r\n"
* @param bool $bHtmlEncodeSpecialChars = false
*
* @return \MailSo\Log\Drivers\Inline
*/
public static function NewInstance($sNewLine = "\r\n", $bHtmlEncodeSpecialChars = false)
public static function NewInstance(string $sNewLine = "\r\n", bool $bHtmlEncodeSpecialChars = false) : \MailSo\Log\Drivers\Inline
{
return new self($sNewLine, $bHtmlEncodeSpecialChars);
}
/**
* @param string $mDesc
*
* @return bool
*/
protected function writeImplementation($mDesc)
protected function writeImplementation($mDesc) : bool
{
if (\is_array($mDesc))
{
@ -74,10 +57,7 @@ class Inline extends \MailSo\Log\Driver
return true;
}
/**
* @return bool
*/
protected function clearImplementation()
protected function clearImplementation() : bool
{
if (\defined('PHP_SAPI') && 'cli' === PHP_SAPI && \MailSo\Base\Utils::FunctionExistsAndEnabled('system'))
{

View file

@ -20,9 +20,6 @@ class Syslog extends \MailSo\Log\Driver
{
private $iLogLevel;
/**
* @access protected
*/
protected function __construct()
{
parent::__construct();
@ -43,20 +40,12 @@ class Syslog extends \MailSo\Log\Driver
}
}
/**
* @return \MailSo\Log\Drivers\Syslog
*/
public static function NewInstance()
public static function NewInstance() : \MailSo\Log\Drivers\Syslog
{
return new self();
}
/**
* @param string|array $mDesc
*
* @return bool
*/
protected function writeImplementation($mDesc)
protected function writeImplementation($mDesc) : bool
{
if (null === $this->iLogLevel)
{
@ -71,10 +60,7 @@ class Syslog extends \MailSo\Log\Driver
return \syslog($this->iLogLevel, $mDesc);
}
/**
* @return bool
*/
protected function clearImplementation()
protected function clearImplementation() : bool
{
return true;
}