Skip to content

Commit

Permalink
Merge pull request #59 from ergebnis/fix/wrap
Browse files Browse the repository at this point in the history
Fix: Wrap closure
  • Loading branch information
localheinz authored Mar 21, 2022
2 parents 9321094 + 500054d commit 64fc563
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 @@ -60,7 +60,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 64fc563

Please sign in to comment.