Skip to content

Commit

Permalink
Fix: Wrap closure
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Mar 21, 2022
1 parent 4717354 commit 500054d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Specification.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 500054d

Please sign in to comment.