format($this->format); * } * } * * final readonly class Event * { * public function __construct( * public string $eventName, * #[\My\App\DateTimeFormat('Y/m/d')] * public \DateTimeInterface $date, * ) {} * } * * (new \OCA\Talk\Vendor\CuyZ\Valinor\NormalizerBuilder()) * ->normalizer(\OCA\Talk\Vendor\CuyZ\Valinor\Normalizer\Format::array()) * ->normalize(new \My\App\Event( * eventName: 'Release of legendary album', * date: new \DateTimeImmutable('1971-11-08'), * )); * * // [ * // 'eventName' => 'Release of legendary album', * // 'date' => '1971/11/08', * // ] * ``` * * @api */ #[Attribute(Attribute::TARGET_CLASS)] final class AsTransformer {}