Ignore defined + empty check php stan errors

This commit is contained in:
Clemens Schwaighofer
2021-11-02 10:06:30 +09:00
parent 0f38cb4f89
commit f9072f64f1
3 changed files with 7 additions and 2 deletions

View File

@@ -48,7 +48,7 @@ parameters:
# ignore errores with # ignore errores with
ignoreErrors: ignoreErrors:
# this is ignored for now # this is ignored for now
- '#Expression in empty\(\) is always falsy.#' # - '#Expression in empty\(\) is always falsy.#'
# - # -
# message: '#Reflection error: [a-zA-Z0-9\\_]+ not found.#' # message: '#Reflection error: [a-zA-Z0-9\\_]+ not found.#'
# path: www/includes/edit_base.php # path: www/includes/edit_base.php

View File

@@ -191,7 +191,8 @@ class Login extends \CoreLibs\DB\IO
exit; exit;
} }
// set global is ajax page for if we show the data directly, or need to pass it back // set global is ajax page for if we show the data directly,
// or need to pass it back
// to the continue AJAX class for output back to the user // to the continue AJAX class for output back to the user
$this->login_is_ajax_page = isset($GLOBALS['AJAX_PAGE']) && $GLOBALS['AJAX_PAGE'] ? true : false; $this->login_is_ajax_page = isset($GLOBALS['AJAX_PAGE']) && $GLOBALS['AJAX_PAGE'] ? true : false;
// set the default lang // set the default lang
@@ -207,6 +208,7 @@ class Login extends \CoreLibs\DB\IO
// check what schema to use. if there is a login schema use this, else check // check what schema to use. if there is a login schema use this, else check
// if there is a schema set in the config, or fall back to DB_SCHEMA // if there is a schema set in the config, or fall back to DB_SCHEMA
// if this exists, if this also does not exists use public schema // if this exists, if this also does not exists use public schema
/** @phpstan-ignore-next-line */
if (defined('LOGIN_DB_SCHEMA') && !empty(LOGIN_DB_SCHEMA)) { if (defined('LOGIN_DB_SCHEMA') && !empty(LOGIN_DB_SCHEMA)) {
$SCHEMA = LOGIN_DB_SCHEMA; $SCHEMA = LOGIN_DB_SCHEMA;
} elseif (isset($db_config['db_schema']) && $db_config['db_schema']) { } elseif (isset($db_config['db_schema']) && $db_config['db_schema']) {
@@ -216,6 +218,7 @@ class Login extends \CoreLibs\DB\IO
} else { } else {
$SCHEMA = 'public'; $SCHEMA = 'public';
} }
// echo "<h1>*****SCHEMA******</h1>: $SCHEMA<br>";
// set schema if schema differs to schema set in db conneciton // set schema if schema differs to schema set in db conneciton
if ($this->dbGetSchema() && $this->dbGetSchema() != $SCHEMA) { if ($this->dbGetSchema() && $this->dbGetSchema() != $SCHEMA) {
$this->dbExec("SET search_path TO " . $SCHEMA); $this->dbExec("SET search_path TO " . $SCHEMA);

View File

@@ -208,6 +208,7 @@ class Backend extends \CoreLibs\DB\IO
// check schema // check schema
$SCHEMA = 'public'; $SCHEMA = 'public';
/** @phpstan-ignore-next-line */
if (defined('LOGIN_DB_SCHEMA') && !empty(LOGIN_DB_SCHEMA)) { if (defined('LOGIN_DB_SCHEMA') && !empty(LOGIN_DB_SCHEMA)) {
$SCHEMA = LOGIN_DB_SCHEMA; $SCHEMA = LOGIN_DB_SCHEMA;
} elseif ($this->dbGetSchema()) { } elseif ($this->dbGetSchema()) {
@@ -511,6 +512,7 @@ class Backend extends \CoreLibs\DB\IO
string $associate = null, string $associate = null,
string $file = null string $file = null
): void { ): void {
/** @phpstan-ignore-next-line */
if (defined('GLOBAL_DB_SCHEMA') && !empty(GLOBAL_DB_SCHEMA)) { if (defined('GLOBAL_DB_SCHEMA') && !empty(GLOBAL_DB_SCHEMA)) {
$SCHEMA = GLOBAL_DB_SCHEMA; $SCHEMA = GLOBAL_DB_SCHEMA;
} elseif ($this->dbGetSchema()) { } elseif ($this->dbGetSchema()) {