diff --git a/core/imageboard/tag.php b/core/imageboard/tag.php index 95c266ccb..939db1d8b 100644 --- a/core/imageboard/tag.php +++ b/core/imageboard/tag.php @@ -129,7 +129,7 @@ public static function implode(array $tags): string /** * Turn a human-supplied string into a valid tag array. * - * @return string[] + * @return list */ public static function explode(string $tags, bool $tagme = true): array { diff --git a/ext/index/events.php b/ext/index/events.php index d3ebb3ddc..8f640fa05 100644 --- a/ext/index/events.php +++ b/ext/index/events.php @@ -35,7 +35,7 @@ public function __construct(int $id, ?string $term = null, array $context = []) if ($term !== null) { // pull any operands off the start of the search term - while (is_string($term) && !empty($term) && array_key_exists($term[0], TAG_OPERANDS)) { + while (!empty($term) && array_key_exists($term[0], TAG_OPERANDS)) { $operand = TAG_OPERANDS[$term[0]]; $term = substr($term, 1); $this->$operand = true; diff --git a/ext/ouroboros_api/main.php b/ext/ouroboros_api/main.php index 1ea16e02c..381f841f3 100644 --- a/ext/ouroboros_api/main.php +++ b/ext/ouroboros_api/main.php @@ -419,9 +419,6 @@ protected function postIndex(int $limit, int $page, array $tags): void $results = Search::find_images(max($start, 0), min($limit, 100), $tags); $posts = []; foreach ($results as $img) { - if (!is_object($img)) { - continue; - } $posts[] = new _SafeOuroborosImage($img); } $this->sendData('post', $posts, max($start, 0)); diff --git a/ext/post_tags/main.php b/ext/post_tags/main.php index b033f5b77..67ec884ac 100644 --- a/ext/post_tags/main.php +++ b/ext/post_tags/main.php @@ -109,7 +109,7 @@ public function matches(string $regex): ?array { $matches = []; if (\Safe\preg_match($regex, $this->term, $matches) === 1) { - return $matches; + return array_values($matches); } return null; } diff --git a/ext/random_image/test.php b/ext/random_image/test.php index 6d45b79ce..e01ac1a1a 100644 --- a/ext/random_image/test.php +++ b/ext/random_image/test.php @@ -19,7 +19,7 @@ public function testRandom(): void $this->assertEquals("Post $image_id: test", $page->title); $page = $this->get_page("random_image/download"); - $this->assertNotNull($page->data); + $this->assertEquals($page->mode, PageMode::FILE); # FIXME: assert($raw == file(blah.jpg)) } @@ -37,7 +37,7 @@ public function testPostListBlock(): void # enabled, image = text $image_id = $this->post_image("tests/pbx_screenshot.jpg", "test"); $page = $this->get_page("post/list"); - $this->assertNotNull($page->find_block("Random Post")); + $page->find_block("Random Post"); // will throw if missing # disabled, image = no text $config->set_bool("show_random_block", false); diff --git a/ext/user/events.php b/ext/user/events.php index 82042efe9..06233cefd 100644 --- a/ext/user/events.php +++ b/ext/user/events.php @@ -44,7 +44,7 @@ public function __construct( class UserCreationEvent extends Event { - private ?User $user; + private ?User $user = null; public function __construct( public string $username, diff --git a/ext/word_filter/main.php b/ext/word_filter/main.php index c2f070b6c..b73a35d58 100644 --- a/ext/word_filter/main.php +++ b/ext/word_filter/main.php @@ -37,7 +37,6 @@ private function filter(string $text): string $search = "/\\b" . str_replace("/", "\\/", $search) . "\\b/i"; $text = preg_replace_ex($search, $replace, $text); } - assert(is_string($text)); } return $text; }