File tree Expand file tree Collapse file tree 6 files changed +61
-12
lines changed
Expand file tree Collapse file tree 6 files changed +61
-12
lines changed Original file line number Diff line number Diff line change 1414use PhpTypedValues \Undefined \Alias \Undefined ;
1515
1616/**
17- * ATOM RFC 3339 format based on ISO 8601.
17+ * Date-time value formatted using PHP's DATE_ATOM ( RFC 3339 based on ISO 8601) .
1818 *
19- * Example "2025-01-02T03:04:05+00:00"
19+ * Provides strict parsing with detailed error aggregation via the base
20+ * DateTimeType, preserves the exact offset, and guarantees round-trip
21+ * formatting using DATE_ATOM.
22+ *
23+ * Example
24+ * - $v = DateTimeAtom::fromString('2025-01-02T03:04:05+00:00');
25+ * $v->toString(); // "2025-01-02T03:04:05+00:00"
26+ * - $v = DateTimeAtom::fromDateTime(new DateTimeImmutable('2030-12-31T23:59:59+03:00'));
27+ * (string) $v; // "2030-12-31T23:59:59+03:00"
2028 *
2129 * @psalm-immutable
2230 */
Original file line number Diff line number Diff line change 1414use PhpTypedValues \Undefined \Alias \Undefined ;
1515
1616/**
17- * RFC 3339 format based on ISO 8601.
17+ * Date-time value formatted using PHP's DATE_RFC3339 ( RFC 3339 based on ISO 8601) .
1818 *
19- * Example "2025-01-02T03:04:05+00:00"
19+ * Leverages the common DateTimeType parsing that aggregates parser errors and
20+ * warnings, enforces strict round-trip formatting, and normalizes timezone
21+ * handling. Guarantee output formatted with DATE_RFC3339.
22+ *
23+ * Example
24+ * - $v = DateTimeRFC3339::fromString('2025-01-02T03:04:05+00:00');
25+ * $v->toString(); // "2025-01-02T03:04:05+00:00"
26+ * - $v = DateTimeRFC3339::fromDateTime(new DateTimeImmutable('2030-12-31T23:59:59+03:00'));
27+ * (string) $v; // "2030-12-31T23:59:59+03:00"
2028 *
2129 * @psalm-immutable
2230 */
Original file line number Diff line number Diff line change 1414use PhpTypedValues \Undefined \Alias \Undefined ;
1515
1616/**
17- * RFC 3339 EXTENDED format based on ISO 8601 ( with microseconds).
17+ * Date-time value formatted using PHP's DATE_RFC3339_EXTENDED (RFC 3339 with microseconds).
1818 *
19- * Example "2025-01-02T03:04:05.123456+00:00"
19+ * Inherits strict parsing and validation from DateTimeType, including detailed
20+ * parser error aggregation and exact round-trip checks. Ensures output
21+ * formatting with DATE_RFC3339_EXTENDED, preserving fractional seconds and
22+ * timezone offset.
23+ *
24+ * Example
25+ * - $v = DateTimeRFC3339Extended::fromString('2025-01-02T03:04:05.123456+00:00');
26+ * $v->toString(); // "2025-01-02T03:04:05.123456+00:00"
27+ * - $v = DateTimeRFC3339Extended::fromDateTime(new DateTimeImmutable('2030-12-31T23:59:59.654321+03:00'));
28+ * (string) $v; // "2030-12-31T23:59:59.654321+03:00"
2029 *
2130 * @psalm-immutable
2231 */
Original file line number Diff line number Diff line change 1414use PhpTypedValues \Undefined \Alias \Undefined ;
1515
1616/**
17- * W3C RFC 3339 format based on ISO 8601.
17+ * Date-time value formatted using PHP's DATE_W3C (W3C profile of ISO 8601/RFC 3339) .
1818 *
19- * Example "2025-01-02T03:04:05+00:00"
19+ * Uses the shared DateTimeType mechanics for strict parsing with aggregated
20+ * errors and warnings, exact round-trip verification, and normalized timezone
21+ * handling. Guarantees output using DATE_W3C format.
22+ *
23+ * Example
24+ * - $v = DateTimeW3C::fromString('2025-01-02T03:04:05+00:00');
25+ * $v->toString(); // "2025-01-02T03:04:05+00:00"
26+ * - $v = DateTimeW3C::fromDateTime(new DateTimeImmutable('2030-12-31T23:59:59+03:00'));
27+ * (string) $v; // "2030-12-31T23:59:59+03:00"
2028 *
2129 * @psalm-immutable
2230 */
Original file line number Diff line number Diff line change 1414use function sprintf ;
1515
1616/**
17- * Unix timestamp in milliseconds since Unix epoch (UTC).
17+ * Unix timestamp value in milliseconds since the Unix epoch (UTC).
1818 *
19- * Example "1732445696123"
19+ * Accepts a strictly numeric milliseconds string and converts it to an
20+ * internal DateTimeImmutable with microsecond precision. Parsing and
21+ * validation leverage DateTimeType, including detailed error aggregation and
22+ * strict round‑trip verification. Output is rendered back to milliseconds.
23+ *
24+ * Example
25+ * - $v = TimestampMilliseconds::fromString('1732445696123');
26+ * $v->toString(); // "1732445696123"
27+ * - $v = TimestampMilliseconds::fromString('0');
28+ * (string) $v; // "0"
2029 *
2130 * @psalm-immutable
2231 */
Original file line number Diff line number Diff line change 1111use PhpTypedValues \Undefined \Alias \Undefined ;
1212
1313/**
14- * Unix timestamp ( seconds since Unix epoch, UTC).
14+ * Unix timestamp value in whole seconds since the Unix epoch ( UTC).
1515 *
16- * Example "1732445696"
16+ * Parses and formats using the 'U' pattern via the base DateTimeType, which
17+ * performs strict error aggregation, round‑trip validation, and timezone
18+ * normalization. Output has been guaranteed to be seconds since epoch as a string.
19+ *
20+ * Example
21+ * - $v = TimestampSeconds::fromString('1732445696');
22+ * $v->toString(); // "1732445696"
23+ * - (string) TimestampSeconds::fromString('0'); // "0"
1724 *
1825 * @psalm-immutable
1926 */
You can’t perform that action at this time.
0 commit comments