@@ -14,13 +14,14 @@ private function __construct() {}
1414 * @param array<mixed> $args
1515 */
1616 final public static function of (mixed ...$ args ): self {
17+ // @phpstan-ignore argument.type
1718 $ constructor = static fn () => new self (...$ args );
1819
1920 return self ::resolve ($ constructor , self ::inputIdentity (...$ args ));
2021 }
2122
2223 /**
23- * @param self| callable():self $ref
24+ * @param callable():self $ref
2425 * @phpstan-param array-key|null $key
2526 */
2627 final protected static function resolve (callable $ ref , int |string |null $ key ): self {
@@ -33,6 +34,7 @@ final protected static function resolve(callable $ref, int|string|null $key): se
3334 static $ mem = [];
3435
3536 if (\array_key_exists ($ key , $ mem )) {
37+ // @phpstan-ignore return.type
3638 return $ mem [$ key ]->get ();
3739 }
3840
@@ -64,13 +66,17 @@ protected static function inputIdentity(mixed ...$args): int|string|null {
6466 return null ;
6567 }
6668
69+ /**
70+ * @throws \LogicException
71+ */
6772 final public function __clone (): never
6873 {
6974 throw new \LogicException ('Value Object ' . static ::class . ' using ' . Identity::class . ' can \'t be cloned ' );
7075 }
7176
7277 /**
7378 * @param array<mixed> $data
79+ * @throws \LogicException
7480 */
7581 final public function __unserialize (array $ data ): never
7682 {
@@ -88,6 +94,7 @@ final public function __unserialize(array $data): never
8894 */
8995 public static function __set_state (array $ data ): self
9096 {
97+ // @phpstan-ignore argument.type
9198 return self ::of (...$ data );
9299 }
93100}
0 commit comments