phpstan l1 (incomplete)

This commit is contained in:
2023-04-13 22:43:15 +02:00
parent 273db5f183
commit 0e014c6829
10 changed files with 32 additions and 12 deletions

7
phpstan.neon Normal file
View File

@@ -0,0 +1,7 @@
parameters:
level: 1
paths:
- src
- tools
# vim: set noexpandtab ts=4 sw=2: nolist #

View File

@@ -311,6 +311,7 @@ class Ipaddresses
$e[count($e) - 1] = "0";
}
$s = 8 - count($e);
$newipv6 = [];
foreach ($e as $key => $val) {
if ($val === "") {
for ($i = 0; $i <= $s; $i++) {

View File

@@ -72,14 +72,16 @@ class Logger
* LOG_INFO informational message
* LOG_DEBUG debug-level message
*/
private $priorities = [LOG_EMERG => "EMERG",
private $priorities = [
LOG_EMERG => "EMERG",
LOG_ALERT => "ALERT",
LOG_CRIT => "CRITICAL",
LOG_ERR => "ERROR",
LOG_WARNING => "WARNING",
LOG_NOTICE => "NOTICE",
LOG_INFO => "INFO",
LOG_DEBUG => "DEBUG"];
LOG_DEBUG => "DEBUG",
];
/**
* Catch all the messages raised by the PHP, in trigger_error
@@ -103,6 +105,7 @@ class Logger
// This error code is not included in error_reporting
return;
}
$priority = LOG_ERR;
switch ($errno) {
case E_ERROR:
$priority = LOG_ERR;
@@ -111,7 +114,7 @@ class Logger
$priority = LOG_WARNING;
break;
case E_PARSE:
$priority = LOG_PARSE;
$priority = LOG_ERR;
break;
case E_NOTICE:
$priority = LOG_NOTICE;
@@ -225,6 +228,7 @@ class Logger
if ($this->loglevelmin < $priority) {
return;
}
$back = [];
$backtrace = debug_backtrace();
for ($i = 0; $i <= $this->backTraceSkip; $i++) {
$back = array_shift($backtrace);
@@ -271,6 +275,7 @@ class Logger
$msg .= "\n" . ($e->getTraceAsString());
}
$logsType = [];
if (is_string($this->logtype)) {
$logsType = explode("|", $this->logtype);
} elseif (is_array($this->logtype)) {

View File

@@ -53,6 +53,7 @@ class Queue
*/
public function getAll()
{
return [];
}
/**
@@ -100,5 +101,6 @@ class Queue
*/
public function getRange($start, $number, $delete = false)
{
return [];
}
}

View File

@@ -153,6 +153,7 @@ class Renderer
$dataflash = "";
if (isset($_SESSION["renderer"]["flash"])) {
foreach ($_SESSION["renderer"]["flash"] as $flash) {
$alert = "";
$dataflash .= "<div class='alert ";
switch ($flash[0]) {
case 4:

View File

@@ -221,6 +221,7 @@ class RouteSQL
} else {
if (isset($_SESSION["renderer"]["flash"])) {
foreach ($_SESSION["renderer"]["flash"] as $flash) {
$alert = "";
$dataflash .= "<div class='alert ";
switch ($flash[0]) {
case 4:

View File

@@ -184,6 +184,8 @@ class Tcpclient
} else {
$ips = array_merge($this->ipv6, $this->ipv4);
}
$errno = -1;
$errstr = "";
foreach ($ips as $ip) {
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$ip = "[$ip]";

View File

@@ -531,6 +531,7 @@ class Xdiff
{
$found1 = false;
$found2 = false;
$tmp1 = $tmp2 = -1;
while ($i < count($array1)) {
$tmp2 = $j;
while ($tmp2 < count($array2)) {

View File

@@ -178,5 +178,5 @@ if (! isset($argv[3])) {
if (! isset($argv[4])) {
die("No output file provided\n");
}
$modelgraph = new modelgraph($argv[1], $argv[2], $argv[3], $argv[4]);
$modelgraph = new Modelgraph($argv[1], $argv[2], $argv[3], $argv[4]);
$modelgraph->generate();

View File

@@ -101,7 +101,7 @@ class Main
if (! file_exists($configurationFile)) {
touch($configurationFile);
}
$config = new Domframework\Configuration();
$config = new Configuration();
$config->confFile = $configurationFile;
$db = $config->get("db");
@@ -400,7 +400,7 @@ class Main
}
try {
$main = new \main();
$main = new \Main();
} catch (Exception $e) {
file_put_contents("php://stderr", $e->getMessage() . "\n");
exit(4);