From 0d84bfbdfaefa56e11310e14e11944a57a1b67af Mon Sep 17 00:00:00 2001 From: Sebastix Date: Sun, 24 Nov 2024 22:38:53 +0100 Subject: [PATCH] fix https://github.com/nostrver-se/nostr-php/issues/63 and provide better exception message when tags is not formatted correct --- src/Filter/Filter.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Filter/Filter.php b/src/Filter/Filter.php index a67f8eb..6aefeaa 100644 --- a/src/Filter/Filter.php +++ b/src/Filter/Filter.php @@ -7,8 +7,7 @@ use swentel\nostr\FilterInterface; use swentel\nostr\Key\Key; -use function PHPUnit\Framework\throwException; - +#[\AllowDynamicProperties] class Filter implements FilterInterface { /** @@ -46,7 +45,7 @@ class Filter implements FilterInterface */ public int $since; - /** + /**t * An integer unix timestamp in seconds, events must be older than this to pass */ public int $until; @@ -160,7 +159,7 @@ private function validateTagName($tag): void { // Check if tag starts with #. if (!str_starts_with($tag, '#')) { - throw new \RuntimeException('All tags must start with #'); + throw new \RuntimeException('All tags on a filter must start with #'); } // Check if tag has valid value. $pattern = '/^#[a-z_-]+$/i';