File tree Expand file tree Collapse file tree 7 files changed +67
-8
lines changed
Expand file tree Collapse file tree 7 files changed +67
-8
lines changed Original file line number Diff line number Diff line change 77use PhpTypedValues \Float \FloatStandard ;
88
99/**
10+ * Alias for the generic float-typed value ("double").
11+ *
12+ * Provides the same behavior as FloatStandard while offering a commonly used
13+ * synonym name "Double".
14+ *
15+ * Example
16+ * - $v = Double::fromString('2.5');
17+ * $v->toString(); // "2.5"
18+ * - $v = Double::fromFloat(0.75);
19+ * (string) $v; // "0.75"
20+ *
1021 * @psalm-immutable
1122 */
1223readonly class Double extends FloatStandard
Original file line number Diff line number Diff line change 77use PhpTypedValues \Float \FloatStandard ;
88
99/**
10+ * Alias for the generic float-typed value.
11+ *
12+ * Provides the same behavior as FloatStandard while offering a more descriptive
13+ * name for APIs that prefer "FloatType".
14+ *
15+ * Example
16+ * - $v = FloatType::fromString('1.25');
17+ * $v->toString(); // "1.25"
18+ *
1019 * @psalm-immutable
1120 */
1221readonly class FloatType extends FloatStandard
Original file line number Diff line number Diff line change 77use PhpTypedValues \Float \FloatNonNegative ;
88
99/**
10- * Alias of Non- negative float (>= 0.0).
10+ * Alias for non‑ negative float-typed value (>= 0.0).
1111 *
12- * Example "0.0"
12+ * Provides the same behavior as FloatNonNegative while exposing a concise
13+ * name suitable for APIs that prefer "NonNegative".
14+ *
15+ * Example
16+ * - $v = NonNegative::fromString('0.0');
17+ * $v->value(); // 0.0
18+ * - $v = NonNegative::fromFloat(10.25);
19+ * (string) $v; // "10.25"
1320 *
1421 * @psalm-immutable
1522 */
Original file line number Diff line number Diff line change 77use PhpTypedValues \Float \FloatPositive ;
88
99/**
10+ * Alias for positive float-typed value (> 0.0).
11+ *
12+ * Provides the same behavior as FloatPositive while exposing a concise name
13+ * suitable for APIs that prefer "Positive".
14+ *
15+ * Example
16+ * - $v = Positive::fromString('0.1');
17+ * $v->value(); // 0.1
18+ * - $v = Positive::fromFloat(2.5);
19+ * (string) $v; // "2.5"
20+ *
1021 * @psalm-immutable
1122 */
1223readonly class Positive extends FloatPositive
Original file line number Diff line number Diff line change 1212use function sprintf ;
1313
1414/**
15- * Non- negative float (>= 0.0).
15+ * Non‑ negative float-typed value (>= 0.0).
1616 *
17- * Example "0.0"
17+ * Guarantees the wrapped float is zero or positive. Offers factories from
18+ * validated string and native float, plus standard string formatting.
19+ *
20+ * Example
21+ * - $v = FloatNonNegative::fromString('0.0');
22+ * $v->value(); // 0.0
23+ * - $v = FloatNonNegative::fromFloat(10.25);
24+ * (string) $v; // "10.25"
1825 *
1926 * @psalm-immutable
2027 */
Original file line number Diff line number Diff line change 1212use function sprintf ;
1313
1414/**
15- * Positive float (> 0.0).
15+ * Positive float-typed value (> 0.0).
1616 *
17- * Example "0.1"
17+ * Ensures the wrapped float is strictly greater than zero. Provides factories
18+ * from validated string and native float and convenient formatting helpers.
19+ *
20+ * Example
21+ * - $v = FloatPositive::fromString('0.1');
22+ * $v->value(); // 0.1
23+ * - $v = FloatPositive::fromFloat(2.5);
24+ * (string) $v; // "2.5"
1825 *
1926 * @psalm-immutable
2027 */
Original file line number Diff line number Diff line change 1010use PhpTypedValues \Undefined \Alias \Undefined ;
1111
1212/**
13- * Represents any PHP float (double) .
13+ * Generic float-typed value .
1414 *
15- * Example "3.14"
15+ * Wraps any PHP float (double) and provides factories from native float or
16+ * validated string, along with convenient string formatting.
17+ *
18+ * Example
19+ * - $v = FloatStandard::fromString('3.14');
20+ * $v->value(); // 3.14 (float)
21+ * - $v = FloatStandard::fromFloat(0.5);
22+ * (string) $v; // "0.5"
1623 *
1724 * @psalm-immutable
1825 */
You can’t perform that action at this time.
0 commit comments