Skip to content

Commit 8bbf495

Browse files
committed
Add examples to PHPdoc for typed values and introduce FloatType, IntType, and StrType alias classes
- Enhanced PHPdoc comments across multiple classes with usage examples for clarity and better documentation. - Introduced alias classes (`FloatType`, `IntType`, `StrType`) for core types to improve extensibility and consistency. - Updated `psalmTest.php` with added alias usage demonstrations.
1 parent d7a7419 commit 8bbf495

26 files changed

+119
-3
lines changed

src/DateTime/DateTimeAtom.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
/**
1515
* ATOM RFC 3339 format based on ISO 8601.
1616
*
17+
* Example "2025-01-02T03:04:05+00:00"
18+
*
1719
* @psalm-immutable
1820
*/
1921
readonly class DateTimeAtom extends DateTimeType

src/DateTime/DateTimeRFC3339.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
/**
1515
* RFC 3339 format based on ISO 8601.
1616
*
17+
* Example "2025-01-02T03:04:05+00:00"
18+
*
1719
* @psalm-immutable
1820
*/
1921
readonly class DateTimeRFC3339 extends DateTimeType

src/DateTime/DateTimeRFC3339Extended.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
use PhpTypedValues\Code\Exception\DateTimeTypeException;
1313

1414
/**
15-
* RFC 3339 EXTENDED format based on ISO 8601.
15+
* RFC 3339 EXTENDED format based on ISO 8601 (with microseconds).
16+
*
17+
* Example "2025-01-02T03:04:05.123456+00:00"
1618
*
1719
* @psalm-immutable
1820
*/

src/DateTime/DateTimeW3C.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
/**
1515
* W3C RFC 3339 format based on ISO 8601.
1616
*
17+
* Example "2025-01-02T03:04:05+00:00"
18+
*
1719
* @psalm-immutable
1820
*/
1921
readonly class DateTimeW3C extends DateTimeType

src/DateTime/Timestamp/TimestampMilliseconds.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
use function sprintf;
1313

1414
/**
15-
* Unix timestamp in milliseconds since Unix epoch (UTC), e.g. "1732445696123".
15+
* Unix timestamp in milliseconds since Unix epoch (UTC).
16+
*
17+
* Example "1732445696123"
1618
*
1719
* @psalm-immutable
1820
*/

src/DateTime/Timestamp/TimestampSeconds.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
use PhpTypedValues\Code\Exception\DateTimeTypeException;
1010

1111
/**
12-
* Unix timestamp (seconds since Unix epoch, UTC), e.g. "1732445696".
12+
* Unix timestamp (seconds since Unix epoch, UTC).
13+
*
14+
* Example "1732445696"
1315
*
1416
* @psalm-immutable
1517
*/

src/Float/Alias/FloatType.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpTypedValues\Float\Alias;
6+
7+
use PhpTypedValues\Float\FloatStandard;
8+
9+
/**
10+
* @psalm-immutable
11+
*/
12+
readonly class FloatType extends FloatStandard
13+
{
14+
}

src/Float/Alias/NonNegativeFloat.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
use PhpTypedValues\Float\FloatNonNegative;
88

99
/**
10+
* Alias of Non-negative float (>= 0.0).
11+
*
12+
* Example "0.0"
13+
*
1014
* @psalm-immutable
1115
*/
1216
readonly class NonNegativeFloat extends FloatNonNegative

src/Float/FloatNonNegative.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
use function sprintf;
1111

1212
/**
13+
* Non-negative float (>= 0.0).
14+
*
15+
* Example "0.0"
16+
*
1317
* @psalm-immutable
1418
*/
1519
readonly class FloatNonNegative extends FloatType

src/Float/FloatStandard.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
/**
1111
* Represents any PHP float (double).
1212
*
13+
* Example "3.14"
14+
*
1315
* @psalm-immutable
1416
*/
1517
readonly class FloatStandard extends FloatType

0 commit comments

Comments
 (0)