]> BookStack Code Mirror - bookstack/blobdiff - app/Search/SearchOptionSet.php
Themes: Documented public file serving
[bookstack] / app / Search / SearchOptionSet.php
index f421abe2c05d02418d3ee8951ced2d0bafb005f5..bd5e5a5b222671a737f620ba9513fdf219655c25 100644 (file)
@@ -63,10 +63,20 @@ class SearchOptionSet
     }
 
     /**
-     * @return T[]
+     * @return self<T>
+     */
+    public function negated(): self
+    {
+        $values = array_values(array_filter($this->options, fn (SearchOption $option) => $option->negated));
+        return new self($values);
+    }
+
+    /**
+     * @return self<T>
      */
-    public function negated(): array
+    public function nonNegated(): self
     {
-        return array_values(array_filter($this->options, fn (SearchOption $option) => $option->negated));
+        $values = array_values(array_filter($this->options, fn (SearchOption $option) => !$option->negated));
+        return new self($values);
     }
 }