Phan and phpstan fixes
Note that ACL\Login FIXME will be fixed later do not change any current functionality
This commit is contained in:
@@ -226,7 +226,7 @@ if (
|
||||
((is_array($DB_CONFIG) && !count($DB_CONFIG)) ||
|
||||
!is_array($DB_CONFIG) ||
|
||||
// has DB CONFIG but no match
|
||||
(is_array($DB_CONFIG) && count($DB_CONFIG) && !isset($DB_CONFIG[$SITE_CONFIG[HOST_NAME]['db_host']])))
|
||||
empty($DB_CONFIG[$SITE_CONFIG[HOST_NAME]['db_host']]))
|
||||
)
|
||||
) {
|
||||
echo 'No matching DB config found for: "' . HOST_NAME . '" . Contact Administrator';
|
||||
|
||||
@@ -367,8 +367,14 @@ class Login extends \CoreLibs\DB\IO
|
||||
}
|
||||
// first, errors on missing encryption
|
||||
if (
|
||||
// below is all deprecated. all the ones below will always be true
|
||||
// all the crypt standards are always set
|
||||
// FIXME: remove this error code
|
||||
/** @phpstan-ignore-next-line Why? */
|
||||
(preg_match("/^\\$2(a|y)\\$/", $hash) && CRYPT_BLOWFISH != 1) ||
|
||||
/** @phpstan-ignore-next-line Why? */
|
||||
(preg_match("/^\\$1\\$/", $hash) && CRYPT_MD5 != 1) ||
|
||||
/** @phpstan-ignore-next-line Why? */
|
||||
(preg_match("/^\\$[0-9A-Za-z.]{12}$/", $hash) && CRYPT_STD_DES != 1)
|
||||
) {
|
||||
// this means password cannot be decrypted because of missing crypt methods
|
||||
|
||||
@@ -128,7 +128,8 @@ class DateTime
|
||||
$timestamp .= '.' . $matches[10];
|
||||
}
|
||||
if ($negative) {
|
||||
$timestamp *= -1;
|
||||
// cast to flaot so we can do a negative multiplication
|
||||
$timestamp = (float)$timestamp * -1;
|
||||
}
|
||||
return $timestamp;
|
||||
} else {
|
||||
|
||||
@@ -1357,7 +1357,7 @@ class IO
|
||||
|
||||
/**
|
||||
* All possible parameter names for dbVersionInfo
|
||||
* @return array List of all parameter names
|
||||
* @return array<mixed> List of all parameter names
|
||||
*/
|
||||
public function dbVersionInfoParameters(): array
|
||||
{
|
||||
@@ -2870,7 +2870,7 @@ class IO
|
||||
*/
|
||||
public function dbGetInsertPKName(): string
|
||||
{
|
||||
return $this->insert_id_pk_name ?? '';
|
||||
return $this->insert_id_pk_name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -617,7 +617,7 @@ class PgSQL implements Interface\SqlFunctions
|
||||
|
||||
/**
|
||||
* Returns all parameters that are possible from the db_version
|
||||
* @return array Parameter key names from pg_version
|
||||
* @return array<mixed> Parameter key names from pg_version
|
||||
*/
|
||||
public function __dbVersionInfoParameterList(): array
|
||||
{
|
||||
@@ -718,18 +718,19 @@ class PgSQL implements Interface\SqlFunctions
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns any server setting, if no connection or empty parameter returns
|
||||
* empty string
|
||||
* @param string $parameter Parameter to query
|
||||
* @return string Settings value as string
|
||||
* Returns any server setting
|
||||
* if no connection or empty parameter or other error returns false
|
||||
* else returns a string
|
||||
* @param string $parameter Parameter to query
|
||||
* @return string|bool Settings value as string
|
||||
*/
|
||||
public function __dbParameter(string $parameter): string
|
||||
public function __dbParameter(string $parameter)
|
||||
{
|
||||
if ($this->dbh === false || is_bool($this->dbh)) {
|
||||
return '';
|
||||
return false;
|
||||
}
|
||||
if (empty($parameter)) {
|
||||
return '';
|
||||
return false;
|
||||
}
|
||||
return pg_parameter_status($this->dbh, $parameter);
|
||||
}
|
||||
|
||||
@@ -867,7 +867,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
$save = $this->l->__('Update');
|
||||
}
|
||||
// print the old_school hidden if requestet
|
||||
if ($old_school_hidden == 1) {
|
||||
if ($old_school_hidden == 1) { /** @phpstan-ignore-line Unclear logic */
|
||||
$pk_name = $this->int_pk_name;
|
||||
$pk_value = $this->table_array[$this->int_pk_name]['value'];
|
||||
}
|
||||
@@ -2488,7 +2488,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
}
|
||||
|
||||
// push in an empty line of this type, but only if we have a delete key that is also filled
|
||||
if (isset($data['delete_name']) && !empty($data['delete_name'])) {
|
||||
if (!empty($data['delete_name'])) {
|
||||
$data['content'][] = $proto;
|
||||
// we also need the pos add or we through an error in smarty
|
||||
$data['pos'][] = [
|
||||
|
||||
@@ -25,8 +25,13 @@ declare(strict_types=1);
|
||||
* @return bool True, so cought errors do not get processed
|
||||
* by the PHP error engine
|
||||
*/
|
||||
function MyErrorHandler(int $type, string $message, string $file, int $line, array $context): bool
|
||||
{
|
||||
function MyErrorHandler(
|
||||
int $type,
|
||||
string $message,
|
||||
string $file,
|
||||
int $line,
|
||||
array $context = []
|
||||
): bool {
|
||||
if (!(error_reporting() & $type) && SHOW_ALL_ERRORS == false) {
|
||||
// This error code is not included in error_reporting
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user