When using a configuration object it makes sense to me to set up constraints when using helpers like forSymmetricSigner.
public static function forSymmetricSigner(
Signer $signer,
Key $key,
?Encoder $encoder = null,
?Decoder $decoder = null
): self {
$result new self(
$signer,
$key,
$key,
$encoder,
$decoder
);
$result->validationConstraints[] = new SignedWith($signer, $key);
return $result;
}
Of course this will then need to be kept in sync when someone calls setSigner later... So additional point: we should make Configuration immutable.
When using a configuration object it makes sense to me to set up constraints when using helpers like
forSymmetricSigner.Of course this will then need to be kept in sync when someone calls
setSignerlater... So additional point: we should makeConfigurationimmutable.