[tests] phpstan version bump
This commit is contained in:
parent
8439e696dc
commit
7b7ec9c83f
7 changed files with 8 additions and 2 deletions
|
@ -659,6 +659,7 @@ function validate_input(array $inputs): array
|
||||||
}
|
}
|
||||||
$outputs[$key] = $id;
|
$outputs[$key] = $id;
|
||||||
} elseif (in_array('user_name', $flags)) {
|
} elseif (in_array('user_name', $flags)) {
|
||||||
|
// @phpstan-ignore-next-line - phpstan thinks $value can never be empty?
|
||||||
if (strlen($value) < 1) {
|
if (strlen($value) < 1) {
|
||||||
throw new InvalidInput("Username must be at least 1 character");
|
throw new InvalidInput("Username must be at least 1 character");
|
||||||
} elseif (!preg_match('/^[a-zA-Z0-9-_]+$/', $value)) {
|
} elseif (!preg_match('/^[a-zA-Z0-9-_]+$/', $value)) {
|
||||||
|
|
|
@ -67,6 +67,7 @@ if(class_exists("\\PHPUnit\\Framework\\TestCase")) {
|
||||||
if (is_null(User::by_name($name))) {
|
if (is_null(User::by_name($name))) {
|
||||||
$userPage = new UserPage();
|
$userPage = new UserPage();
|
||||||
$userPage->onUserCreation(new UserCreationEvent($name, $name, $name, "$name@$name.com", false));
|
$userPage->onUserCreation(new UserCreationEvent($name, $name, $name, "$name@$name.com", false));
|
||||||
|
// @phpstan-ignore-next-line - ???
|
||||||
assert(!is_null(User::by_name($name)), "Creation of user $name failed");
|
assert(!is_null(User::by_name($name)), "Creation of user $name failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,7 @@ function check_im_version(): int
|
||||||
function is_trusted_proxy(): bool
|
function is_trusted_proxy(): bool
|
||||||
{
|
{
|
||||||
$ra = $_SERVER['REMOTE_ADDR'] ?? "0.0.0.0";
|
$ra = $_SERVER['REMOTE_ADDR'] ?? "0.0.0.0";
|
||||||
|
// @phpstan-ignore-next-line - TRUSTED_PROXIES is defined in config
|
||||||
foreach(TRUSTED_PROXIES as $proxy) {
|
foreach(TRUSTED_PROXIES as $proxy) {
|
||||||
if(ip_in_range($ra, $proxy)) {
|
if(ip_in_range($ra, $proxy)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -615,6 +616,7 @@ function _set_up_shimmie_environment(): void
|
||||||
// The trace system has a certain amount of memory consumption every time it is used,
|
// The trace system has a certain amount of memory consumption every time it is used,
|
||||||
// so to prevent running out of memory during complex operations code that uses it should
|
// so to prevent running out of memory during complex operations code that uses it should
|
||||||
// check if tracer output is enabled before making use of it.
|
// check if tracer output is enabled before making use of it.
|
||||||
|
// @phpstan-ignore-next-line - TRACE_FILE is defined in config
|
||||||
$tracer_enabled = !is_null('TRACE_FILE');
|
$tracer_enabled = !is_null('TRACE_FILE');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class IcoFileHandler extends DataHandlerExtension
|
||||||
|
|
||||||
$fp = fopen($event->image->get_image_filename(), "r");
|
$fp = fopen($event->image->get_image_filename(), "r");
|
||||||
try {
|
try {
|
||||||
unpack("Snull/Stype/Scount", fread($fp, 6));
|
fseek($fp, 6); // skip header
|
||||||
$subheader = unpack("Cwidth/Cheight/Ccolours/Cnull/Splanes/Sbpp/Lsize/loffset", fread($fp, 16));
|
$subheader = unpack("Cwidth/Cheight/Ccolours/Cnull/Splanes/Sbpp/Lsize/loffset", fread($fp, 16));
|
||||||
$width = $subheader['width'];
|
$width = $subheader['width'];
|
||||||
$height = $subheader['height'];
|
$height = $subheader['height'];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
parameters:
|
parameters:
|
||||||
errorFormat: raw
|
errorFormat: raw
|
||||||
level: 3
|
level: 4
|
||||||
paths:
|
paths:
|
||||||
- ../core
|
- ../core
|
||||||
- ../ext
|
- ../ext
|
||||||
|
|
|
@ -55,6 +55,7 @@ class CustomViewPostTheme extends ViewPostTheme
|
||||||
if ($image->rating === null || $image->rating == "?") {
|
if ($image->rating === null || $image->rating == "?") {
|
||||||
$image->rating = "?";
|
$image->rating = "?";
|
||||||
}
|
}
|
||||||
|
// @phpstan-ignore-next-line - ???
|
||||||
if (Extension::is_enabled(RatingsInfo::KEY)) {
|
if (Extension::is_enabled(RatingsInfo::KEY)) {
|
||||||
$h_rating = Ratings::rating_to_human($image->rating);
|
$h_rating = Ratings::rating_to_human($image->rating);
|
||||||
$html .= "<br>Rating: $h_rating";
|
$html .= "<br>Rating: $h_rating";
|
||||||
|
|
|
@ -81,6 +81,7 @@ EOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = !empty(CustomIndexTheme::$_search_query) ? html_escape(Tag::implode(CustomIndexTheme::$_search_query)) : "";
|
$query = !empty(CustomIndexTheme::$_search_query) ? html_escape(Tag::implode(CustomIndexTheme::$_search_query)) : "";
|
||||||
|
// @phpstan-ignore-next-line - yes this is deliberately asserting a constant
|
||||||
assert(!is_null($query)); # used in header.inc, do not remove :P
|
assert(!is_null($query)); # used in header.inc, do not remove :P
|
||||||
$flash_html = $this->flash ? "<b id='flash'>".nl2br(html_escape(implode("\n", $this->flash)))."</b>" : "";
|
$flash_html = $this->flash ? "<b id='flash'>".nl2br(html_escape(implode("\n", $this->flash)))."</b>" : "";
|
||||||
$generated = autodate(date('c'));
|
$generated = autodate(date('c'));
|
||||||
|
|
Reference in a new issue