diff --git a/CHANGELOG.md b/CHANGELOG.md
index bd93331..fabb63a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog
+## [Unreleased]
+
+### Added
+
+- `Formal\ORM\Id::for()`
+
## 2.0.2 - 2024-05-29
### Changed
diff --git a/proofs/id.php b/proofs/id.php
index 5f2f383..64614fe 100644
--- a/proofs/id.php
+++ b/proofs/id.php
@@ -22,9 +22,9 @@ static function($assert) {
Set\Uuid::any(),
),
static function($assert, $a, $b) {
- $idA = Id::of(stdClass::class, $a);
- $idABis = Id::of(stdClass::class, $a);
- $idB = Id::of(stdClass::class, $b);
+ $idA = Id::for(stdClass::class)($a);
+ $idABis = Id::for(stdClass::class)($a);
+ $idB = Id::for(stdClass::class)($b);
$assert->true($idA->equals($idA));
$assert->true($idA->equals($idABis));
diff --git a/src/Id.php b/src/Id.php
index ec031b5..94dc9be 100644
--- a/src/Id.php
+++ b/src/Id.php
@@ -64,6 +64,19 @@ public static function of(string $class, string $value): self
return new self($class, $value);
}
+ /**
+ * @template A of object
+ * @psalm-pure
+ *
+ * @param class-string $class
+ *
+ * @return pure-callable(non-empty-string): self
+ */
+ public static function for(string $class): callable
+ {
+ return static fn(string $value) => self::of($class, $value);
+ }
+
/**
* @param self $other
*/