Ignore errors in DB\SQL\PgSQL for phpstan

phpstan will throw an error because pg_* methods have changed from
resource to object in php 8.1
So current var has object|resource dual type and this will fail
Added ignore for phpstan in the config file.
Also added conditional config file for phpstan where we can set based on
current active PHP version
baseline file created with --generate-baseline is added for error check
This commit is contained in:
Clemens Schwaighofer
2022-01-20 13:09:02 +09:00
parent 2a697817fd
commit 6a139d3b7c
5 changed files with 63 additions and 25 deletions

View File

@@ -1,5 +1,6 @@
# PHP Stan Config
includes:
- phpstan-conditional.php
parameters:
tmpDir: /tmp/phpstan-corelibs
level: 8 # max is now 9
@@ -48,6 +49,9 @@ parameters:
- www/admin/class_test.smarty4.php
# ignore errores with
ignoreErrors:
- # this error is ignore because of the PHP 8.0 to 8.1 change for pg_*
message: "#^Parameter \\#1 \\$(result|connection) of function pg_\\w+ expects resource(\\|null)?, object\\|resource(\\|bool)? given\\.$#"
path: %currentWorkingDirectory%/www/lib/CoreLibs/DB/SQL/PgSQL.php
# this is ignored for now
# - '#Expression in empty\(\) is always falsy.#'
# -