diff --git a/Config/phpstan-baseline.neon b/Config/phpstan-baseline.neon index 2b38b1f..7707bf4 100644 --- a/Config/phpstan-baseline.neon +++ b/Config/phpstan-baseline.neon @@ -425,6 +425,11 @@ parameters: count: 1 path: Modules/DatabaseEditor/Models/Table.php + - + message: "#^Parameter \\#1 \\$media of static method Modules\\\\Draw\\\\Models\\\\DrawImage\\:\\:fromMedia\\(\\) expects Modules\\\\Media\\\\Models\\\\Media, Modules\\\\Media\\\\Models\\\\Media\\|null given\\.$#" + count: 1 + path: Modules/Draw/Controller/ApiController.php + - message: "#^Method Modules\\\\Draw\\\\Models\\\\DrawImage\\:\\:jsonSerialize\\(\\) has no return typehint specified\\.$#" count: 1 @@ -605,6 +610,11 @@ parameters: count: 6 path: Modules/HumanResourceManagement/Models/StaffList.php + - + message: "#^Method Modules\\\\HumanResourceManagement\\\\Models\\\\StaffList\\:\\:getList\\(\\) should return array but returns array\\\\|null\\.$#" + count: 1 + path: Modules/HumanResourceManagement/Models/StaffList.php + - message: "#^Method Modules\\\\HumanResourceManagement\\\\Models\\\\StaffList\\:\\:getStats\\(\\) should return array but return statement is missing\\.$#" count: 1 @@ -620,11 +630,21 @@ parameters: count: 2 path: Modules/HumanResourceTimeRecording/Controller/ApiController.php + - + message: "#^Cannot call method getStatus\\(\\) on Modules\\\\HumanResourceTimeRecording\\\\Models\\\\SessionElement\\|null\\.$#" + count: 1 + path: Modules/HumanResourceTimeRecording/Controller/ApiController.php + - message: "#^Cannot call method getId\\(\\) on int\\|Modules\\\\HumanResourceTimeRecording\\\\Models\\\\Session\\.$#" count: 1 path: Modules/HumanResourceTimeRecording/Controller/ApiController.php + - + message: "#^Cannot call method getSession\\(\\) on Modules\\\\HumanResourceTimeRecording\\\\Models\\\\SessionElement\\|null\\.$#" + count: 1 + path: Modules/HumanResourceTimeRecording/Controller/ApiController.php + - message: "#^Call to method getProfile\\(\\) on an unknown class Modules\\\\HumanResourceTimeRecording\\\\Models\\\\Employee\\.$#" count: 2 @@ -880,6 +900,11 @@ parameters: count: 1 path: Modules/Media/Models/Media.php + - + message: "#^Parameter \\#1 \\$known_string of function hash_equals expects string, string\\|null given\\.$#" + count: 1 + path: Modules/Media/Models/Media.php + - message: "#^Method Modules\\\\Media\\\\Models\\\\Media\\:\\:jsonSerialize\\(\\) has no return typehint specified\\.$#" count: 1 @@ -1460,16 +1485,36 @@ parameters: count: 1 path: Modules/TestModule/Controller/Controller.php + - + message: "#^Method Modules\\\\WarehouseManagement\\\\Models\\\\Arrival\\:\\:getDate\\(\\) should return DateTime but returns DateTime\\|null\\.$#" + count: 1 + path: Modules/WarehouseManagement/Models/Arrival.php + + - + message: "#^Method Modules\\\\WarehouseManagement\\\\Models\\\\Arrival\\:\\:getAcceptor\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: Modules/WarehouseManagement/Models/Arrival.php + - message: "#^Property Modules\\\\WarehouseManagement\\\\Models\\\\Article\\:\\:\\$creator has unknown class phpOMS\\\\Models\\\\User as its type\\.$#" count: 1 path: Modules/WarehouseManagement/Models/Article.php + - + message: "#^Method Modules\\\\WarehouseManagement\\\\Models\\\\Article\\:\\:getCreated\\(\\) should return DateTime but returns DateTime\\|null\\.$#" + count: 1 + path: Modules/WarehouseManagement/Models/Article.php + - message: "#^Return typehint of method Modules\\\\WarehouseManagement\\\\Models\\\\Article\\:\\:getCreator\\(\\) has invalid type phpOMS\\\\Models\\\\User\\.$#" count: 1 path: Modules/WarehouseManagement/Models/Article.php + - + message: "#^Method Modules\\\\WarehouseManagement\\\\Models\\\\Article\\:\\:getCreator\\(\\) should return phpOMS\\\\Models\\\\User but returns phpOMS\\\\Models\\\\User\\|null\\.$#" + count: 1 + path: Modules/WarehouseManagement/Models/Article.php + - message: "#^Parameter \\$creator of method Modules\\\\WarehouseManagement\\\\Models\\\\Article\\:\\:setCreator\\(\\) has invalid typehint type phpOMS\\\\Models\\\\User\\.$#" count: 1 @@ -1480,6 +1525,16 @@ parameters: count: 3 path: Modules/WarehouseManagement/Models/Article.php + - + message: "#^Method Modules\\\\WarehouseManagement\\\\Models\\\\Shipping\\:\\:getDelivered\\(\\) should return DateTime but returns DateTime\\|null\\.$#" + count: 1 + path: Modules/WarehouseManagement/Models/Shipping.php + + - + message: "#^Method Modules\\\\WarehouseManagement\\\\Models\\\\Shipping\\:\\:getSender\\(\\) should return int but returns int\\|null\\.$#" + count: 1 + path: Modules/WarehouseManagement/Models/Shipping.php + - message: "#^Property Modules\\\\Workflow\\\\Templates\\\\Permission\\\\Workflow\\:\\:\\$id has no typehint specified\\.$#" count: 1 @@ -1545,6 +1600,16 @@ parameters: count: 1 path: phpOMS/Account/PermissionAbstract.php + - + message: "#^Offset 0 does not exist on array\\(int, int\\)\\|null\\.$#" + count: 6 + path: phpOMS/Algorithm/Maze/MazeGenerator.php + + - + message: "#^Offset 1 does not exist on array\\(int, int\\)\\|null\\.$#" + count: 5 + path: phpOMS/Algorithm/Maze/MazeGenerator.php + - message: "#^Method Model\\\\CoreSettings\\:\\:getOptions\\(\\) has no return typehint specified\\.$#" count: 1 @@ -1770,6 +1835,11 @@ parameters: count: 1 path: phpOMS/DataStorage/Database/Query/Builder.php + - + message: "#^Offset int does not exist on array\\|string\\|null\\.$#" + count: 1 + path: phpOMS/DataStorage/Database/Query/Builder.php + - message: "#^Instanceof between array and phpOMS\\\\DataStorage\\\\Database\\\\Query\\\\Builder will always evaluate to false\\.$#" count: 1 @@ -1930,6 +2000,11 @@ parameters: count: 1 path: phpOMS/Math/Stochastic/NaiveBayesClassifier.php + - + message: "#^Offset 'Content\\-Disposition' does not exist on array\\\\>\\|null\\.$#" + count: 1 + path: phpOMS/Message/Http/HttpRequest.php + - message: "#^Method phpOMS\\\\Message\\\\Mail\\\\EmailAbstract\\:\\:decode\\(\\) should return string but returns string\\|false\\.$#" count: 3 @@ -2520,6 +2595,11 @@ parameters: count: 1 path: phpOMS/Utils/Converter/File.php + - + message: "#^Offset 0 does not exist on array\\\\|null\\.$#" + count: 2 + path: phpOMS/Utils/Encoding/Huffman/Dictionary.php + - message: "#^Method phpOMS\\\\Utils\\\\IO\\\\Csv\\\\CsvInterface\\:\\:exportCsv\\(\\) has no return typehint specified\\.$#" count: 1 @@ -2550,3 +2630,18 @@ parameters: count: 1 path: phpOMS/Utils/Parser/Markdown/Markdown.php + - + message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|null given\\.$#" + count: 1 + path: phpOMS/Utils/Parser/Markdown/Markdown.php + + - + message: "#^Offset 0 does not exist on array\\|null\\.$#" + count: 1 + path: phpOMS/Utils/RnG/Phone.php + + - + message: "#^Offset 1 does not exist on array\\|null\\.$#" + count: 1 + path: phpOMS/Utils/RnG/Phone.php + diff --git a/Helper/testreport.sh b/Helper/testreport.sh index 2faabc2..cc06a4d 100644 --- a/Helper/testreport.sh +++ b/Helper/testreport.sh @@ -1,12 +1,12 @@ #!/bin/bash -mkdir Build/test +mkdir -p Build/test php phpcs.phar ./ --standard="Build/Config/phpcs.xml" -php phpstan.phar analyse --autoload-file=phpOMS/Autoloader.php -l 7 -c Build/Config/phpstan.neon ./ +php phpstan.phar analyse --autoload-file=phpOMS/Autoloader.php -l 8 -c Build/Config/phpstan.neon ./ php phpcs.phar ./ --standard="Build/Config/phpcs.xml" -s --report-junit=Build/test/junit_phpcs.xml -php phpstan.phar analyse --autoload-file=phpOMS/Autoloader.php -l 7 -c Build/Config/phpstan.neon --error-format=prettyJson ./ > Build/test/phpstan.json +php phpstan.phar analyse --autoload-file=phpOMS/Autoloader.php -l 8 -c Build/Config/phpstan.neon --error-format=prettyJson ./ > Build/test/phpstan.json # Remove empty lines and lines with warnings which corrupt the json format sed -i '/^$/d' Build/test/phpstan.json diff --git a/Hooks/tests.sh b/Hooks/tests.sh index 51293f7..801149f 100755 --- a/Hooks/tests.sh +++ b/Hooks/tests.sh @@ -13,7 +13,7 @@ isPhanTestSuccessful() { } isPhpStanTestSuccessful() { - php -d memory_limit=4G ${rootpath}/vendor/bin/phpstan analyse --autoload-file=${rootpath}/phpOMS/Autoloader.php -l 7 -c ${rootpath}/Build/Config/phpstan.neon "$1" >&2 + php -d memory_limit=4G ${rootpath}/vendor/bin/phpstan analyse --autoload-file=${rootpath}/phpOMS/Autoloader.php -l 8 -c ${rootpath}/Build/Config/phpstan.neon "$1" >&2 if [ $? -ne 0 ]; then echo 0 return 0 diff --git a/Inspection/Php/tests.sh b/Inspection/Php/tests.sh index 926d8a9..2884beb 100755 --- a/Inspection/Php/tests.sh +++ b/Inspection/Php/tests.sh @@ -12,9 +12,9 @@ echo "#################################################" echo "Start php static inspection" echo "#################################################" -php -d memory_limit=4G ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 7 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/phpOMS > ${INSPECTION_PATH}/Framework/phpstan.log -php -d memory_limit=4G ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 7 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/Modules > ${INSPECTION_PATH}/Modules/phpstan.log -php -d memory_limit=4G ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 7 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/Model > ${INSPECTION_PATH}/Model/phpstan.log -php -d memory_limit=4G ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 7 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/Web > ${INSPECTION_PATH}/Web/phpstan.log +php -d memory_limit=4G ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 8 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/phpOMS > ${INSPECTION_PATH}/Framework/phpstan.log +php -d memory_limit=4G ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 8 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/Modules > ${INSPECTION_PATH}/Modules/phpstan.log +php -d memory_limit=4G ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 8 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/Model > ${INSPECTION_PATH}/Model/phpstan.log +php -d memory_limit=4G ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 8 -c ${BUILD_PATH}/Config/phpstan.neon ${ROOT_PATH}/Web > ${INSPECTION_PATH}/Web/phpstan.log -php -d memory_limit=4G ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 7 -c ${BUILD_PATH}/Config/phpstan.neon --error-format=json ${ROOT_PATH}/phpOMS > ${INSPECTION_PATH}/Test/Php/phpstan.json +php -d memory_limit=4G ${TOOLS_PATH}/phpstan.phar analyse --autoload-file=${ROOT_PATH}/phpOMS/Autoloader.php -l 8 -c ${BUILD_PATH}/Config/phpstan.neon --error-format=json ${ROOT_PATH}/phpOMS > ${INSPECTION_PATH}/Test/Php/phpstan.json