Add phpstan baseline

This commit is contained in:
Joshua Ramon Enslin 2022-11-17 19:13:13 +01:00
parent 02bd7fce11
commit 34fcc4905a
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
2 changed files with 145 additions and 2 deletions

141
phpstan-baseline.neon Normal file
View File

@ -0,0 +1,141 @@
parameters:
ignoreErrors:
-
message: "#^Calling file_get_contents\\(\\) is forbidden, use MD_STD\\:\\:file_get_contents\\(\\) instead$#"
count: 1
path: classes/MDTlLoader/src/MDTlLoader.php
-
message: "#^Calling json_encode\\(\\) is forbidden, use MD_STD\\:\\:json_encode\\(\\) instead$#"
count: 1
path: classes/MDTlLoader/src/MDTlLoader.php
-
message: "#^Calling mkdir\\(\\) is forbidden, use MD_STD\\:\\:mkdir\\(\\) instead$#"
count: 1
path: classes/MDTlLoader/src/MDTlLoader.php
-
message: "#^Method Redis\\:\\:connect\\(\\) invoked with 7 parameters, 1\\-6 required\\.$#"
count: 1
path: classes/MDTlLoader/src/MDTlLoader.php
-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
count: 3
path: classes/MDTlLoader/src/MDTlLoader.php
-
message: "#^Strict comparison using \\!\\=\\= between string and false will always evaluate to true\\.$#"
count: 1
path: classes/MDTlLoader/src/MDTlLoader.php
-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: classes/MDTlLoader/src/MDTlLoader.php
-
message: "#^Variable variables are not allowed\\.$#"
count: 3
path: classes/MDTlLoader/src/MDTlLoader.php
-
message: "#^Calling file_get_contents\\(\\) is forbidden, use MD_STD\\:\\:file_get_contents\\(\\) instead$#"
count: 1
path: classes/MD_STD/src/MD_STD.php
-
message: "#^Calling json_encode\\(\\) is forbidden, use MD_STD\\:\\:json_encode\\(\\) instead$#"
count: 2
path: classes/MD_STD/src/MD_STD.php
-
message: "#^Calling levenshtein\\(\\) is forbidden, use MD_STD\\:\\:levenshtein\\(\\) instead$#"
count: 1
path: classes/MD_STD/src/MD_STD.php
-
message: "#^Calling mkdir\\(\\) is forbidden, use MD_STD\\:\\:mkdir\\(\\) instead$#"
count: 1
path: classes/MD_STD/src/MD_STD.php
-
message: "#^Calling realpath\\(\\) is forbidden, use MD_STD\\:\\:realpath\\(\\) instead$#"
count: 1
path: classes/MD_STD/src/MD_STD.php
-
message: "#^Calling scandir\\(\\) is forbidden, use MD_STD\\:\\:scandir\\(\\) instead$#"
count: 1
path: classes/MD_STD/src/MD_STD.php
-
message: "#^Calling unlink\\(\\) is forbidden, use MD_STD\\:\\:unlink\\(\\) instead$#"
count: 1
path: classes/MD_STD/src/MD_STD.php
-
message: "#^Method MD_STD\\:\\:get_user_lang\\(\\) should return non\\-empty\\-string but returns string\\.$#"
count: 1
path: classes/MD_STD/src/MD_STD.php
-
message: "#^Method MD_STD\\:\\:scandir\\(\\) should return array\\<non\\-empty\\-string\\> but returns list\\<string\\>\\.$#"
count: 1
path: classes/MD_STD/src/MD_STD.php
-
message: "#^Parameter \\#3 \\$value of function curl_setopt expects resource, resource\\|false given\\.$#"
count: 1
path: classes/MD_STD/src/MD_STD.php
-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
count: 1
path: classes/MD_STD/src/MD_STD.php
-
message: "#^Access to static property \\$redis_pw on an unknown class MD_CONF\\.$#"
count: 1
path: classes/MD_STD/src/MD_STD_CACHE.php
-
message: "#^Method MD_STD_CACHE\\:\\:serve_page_through_redis_cache\\(\\) has parameter \\$redis with a nullable type declaration\\.$#"
count: 1
path: classes/MD_STD/src/MD_STD_CACHE.php
-
message: "#^Method MD_STD_CACHE\\:\\:serve_page_through_redis_cache\\(\\) has parameter \\$redis with null as default value\\.$#"
count: 1
path: classes/MD_STD/src/MD_STD_CACHE.php
-
message: "#^Method Redis\\:\\:connect\\(\\) invoked with 7 parameters, 1\\-6 required\\.$#"
count: 1
path: classes/MD_STD/src/MD_STD_CACHE.php
-
message: "#^Strict comparison using \\!\\=\\= between string and false will always evaluate to true\\.$#"
count: 1
path: classes/MD_STD/src/MD_STD_CACHE.php
-
message: "#^Calling move_uploaded_file\\(\\) is forbidden, use MD_STD_IN\\:\\:move_uploaded_file\\(\\) instead$#"
count: 1
path: classes/MD_STD/src/MD_STD_IN.php
-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
count: 4
path: classes/MD_STD/src/MD_STD_SEC.php
-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with true and non\\-falsy\\-string will always evaluate to true\\.$#"
count: 1
path: tests/CsvxmlAvailableFieldsTest.php
-
message: "#^Instanceof between FieldEntry and FieldEntry will always evaluate to true\\.$#"
count: 1
path: tests/CsvxmlAvailableFieldsTest.php

View File

@ -6,14 +6,15 @@ parameters:
- functions
- inc
- public
- src
- tests
ignoreErrors:
- '#Class MDDBConnectionImpossible not found.#'
- '#Class MDMysqliExpectedError not found.#'
excludePaths:
- classes/MDAllowedValueSets/l18n
bootstrapFiles:
- inc/constants.php
excludes_analyse:
- classes/MDAllowedValueSets/l18n
disallowedFunctionCalls:
-
function: 'ini_alter()'
@ -63,3 +64,4 @@ parameters:
includes:
- classes/MD_QA/rules/phpstan-rules.neon
- vendor/spaze/phpstan-disallowed-calls/extension.neon
- phpstan-baseline.neon