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

@ -27,45 +27,24 @@ class Parameter
*/
private $sValue;
/**
* @access private
*
* @param string $sName
* @param string $sValue
*/
private function __construct($sName, $sValue)
{
$this->sName = $sName;
$this->sValue = $sValue;
}
/**
* @param string $sName
* @param string $sValue = ''
*
* @return \MailSo\Mime\Parameter
*/
public static function NewInstance($sName, $sValue = '')
public static function NewInstance(string $sName, string $sValue = '') : self
{
return new self($sName, $sValue);
}
/**
* @param string $sName
* @param string $sValue = ''
*
* @return \MailSo\Mime\Parameter
*/
public static function CreateFromParameterLine($sRawParam)
public static function CreateFromParameterLine(string $sRawParam) : self
{
$oParameter = self::NewInstance('');
return $oParameter->Parse($sRawParam);
}
/**
* @return \MailSo\Mime\Parameter
*/
public function Reset()
public function Reset() : self
{
$this->sName = '';
$this->sValue = '';
@ -73,29 +52,17 @@ class Parameter
return $this;
}
/**
* @return string
*/
public function Name()
public function Name() : string
{
return $this->sName;
}
/**
* @return string
*/
public function Value()
public function Value() : string
{
return $this->sValue;
}
/**
* @param string $sRawParam
* @param string $sSeparator = '='
*
* @return \MailSo\Mime\Parameter
*/
public function Parse($sRawParam, $sSeparator = '=')
public function Parse(string $sRawParam, string $sSeparator = '=') : self
{
$this->Reset();
@ -110,12 +77,7 @@ class Parameter
return $this;
}
/**
* @param bool $bConvertSpecialsName = false
*
* @return string
*/
public function ToString($bConvertSpecialsName = false)
public function ToString(bool $bConvertSpecialsName = false) : string
{
$sResult = '';
if (0 < strlen($this->sName))