From 500054dd0eac7d57c3587c7c2508518c4399bc6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Mon, 21 Mar 2022 14:21:52 +0100 Subject: [PATCH] Fix: Wrap closure --- src/Specification.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Specification.php b/src/Specification.php index 6101d848..cf5f333d 100644 --- a/src/Specification.php +++ b/src/Specification.php @@ -53,7 +53,9 @@ public static function anyOf(self ...$specifications): self */ public static function closure(\Closure $closure): self { - return new self($closure); + return new self(static function (JsonPointer $jsonPointer) use ($closure): bool { + return true === $closure($jsonPointer); + }); } public static function equals(JsonPointer $other): self