From dba8acea024d803dde8ece8fe649c6066d166b4c Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 16 Dec 2023 01:25:56 +0000 Subject: [PATCH] enable static analysis for all themes --- tests/phpstan.neon | 2 +- themes/rule34v2/index.theme.php | 4 +++- themes/rule34v2/page.class.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/phpstan.neon b/tests/phpstan.neon index 2a379a7f0..9faf61e30 100644 --- a/tests/phpstan.neon +++ b/tests/phpstan.neon @@ -4,6 +4,6 @@ parameters: - ../core - ../ext - ../tests - - ../themes/default + - ../themes ignoreErrors: - '#Access to an undefined property Shimmie2\\Image::\$#' diff --git a/themes/rule34v2/index.theme.php b/themes/rule34v2/index.theme.php index 94793bad0..f7ec7622f 100644 --- a/themes/rule34v2/index.theme.php +++ b/themes/rule34v2/index.theme.php @@ -6,6 +6,8 @@ class CustomIndexTheme extends IndexTheme { + public static array $_search_query = []; + protected function build_table(array $images, ?string $query): string { global $user; @@ -27,7 +29,7 @@ public function display_page(Page $page, $images) $nav = $this->build_navigation($this->page_number, $this->total_pages, $this->search_terms); if (!empty($this->search_terms)) { - $page->_search_query = $this->search_terms; + static::$_search_query = $this->search_terms; } $page->add_block(new Block("Navigation", $nav, "left", 0)); diff --git a/themes/rule34v2/page.class.php b/themes/rule34v2/page.class.php index 94c84eca2..6a1e9d8b3 100644 --- a/themes/rule34v2/page.class.php +++ b/themes/rule34v2/page.class.php @@ -53,7 +53,7 @@ public function render() } } - $query = !empty($this->_search_query) ? html_escape(Tag::implode($this->_search_query)) : ""; + $query = !empty(CustomIndexTheme::$_search_query) ? html_escape(Tag::implode(CustomIndexTheme::$_search_query)) : ""; assert(!is_null($query)); # used in header.inc, do not remove :P $flash_html = $this->flash ? "".nl2br(html_escape(implode("\n", $this->flash)))."" : ""; $generated = autodate(date('c'));