fix l2 errors

This commit is contained in:
Shish 2023-02-03 20:03:04 +00:00
parent ff71a89948
commit fcfeed8413
12 changed files with 21 additions and 16 deletions

View File

@ -395,7 +395,7 @@ abstract class DataHandlerExtension extends Extension
{
global $page;
if ($this->supported_mime($event->image->get_mime())) {
/** @noinspection PhpPossiblePolymorphicInvocationInspection */
// @phpstan-ignore-next-line
$this->theme->display_image($page, $event->image);
}
}

View File

@ -268,7 +268,6 @@ class Image
* Turn a bunch of strings into a bunch of TagCondition
* and ImgCondition objects
*/
/** @var $stpe SearchTermParseEvent */
$stpe = send_event(new SearchTermParseEvent($stpen++, null, $terms));
if ($stpe->order) {
$order = $stpe->order;
@ -288,7 +287,6 @@ class Image
continue;
}
/** @var $stpe SearchTermParseEvent */
$stpe = send_event(new SearchTermParseEvent($stpen++, $term, $terms));
if ($stpe->order) {
$order = $stpe->order;

View File

@ -39,7 +39,7 @@ function ip_in_range(string $IP, string $CIDR): bool
list($net, $mask) = explode("/", $CIDR);
$ip_net = ip2long($net);
$ip_mask = ~((1 << (32 - $mask)) - 1);
$ip_mask = ~((1 << (32 - (int)$mask)) - 1);
$ip_ip = ip2long($IP);
@ -499,7 +499,7 @@ function truncate(string $string, int $limit, string $break=" ", string $pad="..
function parse_shorthand_int(string $limit): int
{
if (preg_match('/^([\d\.]+)([tgmk])?b?$/i', (string)$limit, $m)) {
$value = $m[1];
$value = (float)$m[1];
if (isset($m[2])) {
switch (strtolower($m[2])) {
/** @noinspection PhpMissingBreakStatementInspection */

View File

@ -96,6 +96,10 @@ $_shm_event_count = 0;
/**
* Send an event to all registered Extensions.
*
* @template T of Event
* @param T $event
* @return T
*/
function send_event(Event $event): Event
{

View File

@ -580,9 +580,11 @@ class CommentList extends Extension
$comment
);
// @phpstan-ignore-next-line
if ($akismet->errorsExist()) {
return false;
} else {
// @phpstan-ignore-next-line
return $akismet->isSpam();
}
}

View File

@ -6,6 +6,7 @@ namespace Shimmie2;
class ImageViewCounter extends Extension
{
/** @var ImageViewCounterTheme */
protected ?Themelet $theme;
private int $view_interval = 3600; # allows views to be added each hour

View File

@ -441,8 +441,6 @@ class Pools extends Extension
* When displaying an image, optionally list all the pools that the
* image is currently a member of on a side panel, as well as a link
* to the Next image in the pool.
*
* @var DisplayingImageEvent $event
*/
public function onDisplayingImage(DisplayingImageEvent $event)
{

View File

@ -81,8 +81,8 @@ class PostTitles extends Extension
}
public function onBulkImport(BulkImportEvent $event)
{
if (array_key_exists("title", $event->fields) && $event->fields->title!=null) {
$this->set_title($event->image->id, $event->fields->title);
if (array_key_exists("title", $event->fields) && $event->fields['title']!=null) {
$this->set_title($event->image->id, $event->fields['title']);
}
}

View File

@ -183,9 +183,9 @@ class Ratings extends Extension
public function onBulkImport(BulkImportEvent $event)
{
if (array_key_exists("rating", $event->fields)
&& $event->fields->rating != null
&& Ratings::rating_is_valid($event->fields->rating)) {
$this->set_rating($event->image->id, $event->fields->rating, "");
&& $event->fields['rating'] != null
&& Ratings::rating_is_valid($event->fields['rating'])) {
$this->set_rating($event->image->id, $event->fields['rating'], "");
}
}

View File

@ -44,8 +44,8 @@ class ResolutionLimit extends Extension
continue;
}
$valids++;
$width = $parts[0];
$height = $parts[1];
$width = (int)$parts[0];
$height = (int)$parts[1];
if ($image->width / $width == $image->height / $height) {
$ok = true;
break;

View File

@ -99,6 +99,7 @@ class TaggerXML extends Extension
private function list_to_xml(\FFSPHP\PDOStatement $tags, string $type, string $query, ?array$misc=null): string
{
// @phpstan-ignore-next-line
$r = $tags->_numOfRows;
$s_misc = "";

View File

@ -1,9 +1,10 @@
parameters:
level: 1
level: 2
paths:
- ../core
- ../ext
- ../tests
- ../themes/default
ignoreErrors:
- '#Attribute class GQLA\\Expose#'
- '#Attribute class GQLA\\Expose#'
- '#Access to an undefined property Shimmie2\\Image::\$#'