Introduce type hinting in methods prototype (PHP >= 7.1)

This commit is contained in:
Molkobain
2020-08-26 21:21:56 +02:00
parent 77cd764b1c
commit 825c70c001
30 changed files with 246 additions and 191 deletions

View File

@@ -62,7 +62,7 @@ class QuickCreate extends UIBlock
* @throws \CoreException
* @throws \DictExceptionMissingString
*/
public function __construct($aLastClasses = [], $sId = null)
public function __construct(array $aLastClasses = [], ?string $sId = null)
{
parent::__construct($sId);
$this->aAvailableClasses = UserRights::GetAllowedClasses(UR_ACTION_CREATE, array('bizmodel'), true);
@@ -86,9 +86,10 @@ class QuickCreate extends UIBlock
*
* @return $this
*/
public function SetLastClasses($aLastClasses)
public function SetLastClasses(array $aLastClasses)
{
$this->aLastClasses = $aLastClasses;
return $this;
}

View File

@@ -49,19 +49,19 @@ class QuickCreateHelper
* @throws \MySQLException
* @throws \Exception
*/
public static function AddClassToHistory($Class)
public static function AddClassToHistory($sClass)
{
$aNewEntry = [
'class' => $Class,
'class' => $sClass,
];
/** @var array $aHistoryEntries */
$aHistoryEntries = appUserPreferences::GetPref(static::USER_PREF_CODE, []);
// Remove same entry from history to avoid duplicates
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++)
for ($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++)
{
if($aHistoryEntries[$iIdx]['class'] === $Class)
if ($aHistoryEntries[$iIdx]['class'] === $sClass)
{
unset($aHistoryEntries[$iIdx]);
}