@@ -56,13 +56,15 @@ class Decimal implements JsonSerializable, Stringable
56
56
protected bool $ negative = false ;
57
57
58
58
/**
59
+ * Decimal places to be applied to results
60
+ *
59
61
* decimal(10,6) => 6
60
62
*/
61
63
protected int $ scale = 0 ;
62
64
63
65
/**
64
66
* @param object|string|float|int $value
65
- * @param int|null $scale Leave empty to auto-detect .
67
+ * @param int|null $scale Decimal places in the result. Omit to enable auto-detection .
66
68
*/
67
69
public function __construct (object |string |float |int $ value , ?int $ scale = null )
68
70
{
@@ -143,7 +145,7 @@ protected function normalizeValue(string $value): string
143
145
* it.
144
146
*
145
147
* @param object|string|float|int $value
146
- * @param int|null $scale Leave empty to auto-detect .
148
+ * @param int|null $scale Decimal places in the result. Omit to enable auto-detection .
147
149
*
148
150
* @return static
149
151
*/
@@ -247,7 +249,7 @@ public function compareTo(self|string|float|int $value): int
247
249
* Add $value to this Decimal and return the sum as a new Decimal.
248
250
*
249
251
* @param static|string|float|int $value
250
- * @param int|null $scale Leave empty to auto-detect .
252
+ * @param int|null $scale Decimal places in the result. Omit to enable auto-detection .
251
253
*
252
254
* @return static
253
255
*/
@@ -281,7 +283,7 @@ protected function resultScale(self $a, self $b, ?int $scale = null): int
281
283
* Decimal.
282
284
*
283
285
* @param static|string|float|int $value
284
- * @param int|null $scale Leave empty to auto-detect .
286
+ * @param int|null $scale Decimal places in the result. Omit to enable auto-detection .
285
287
*
286
288
* @return static
287
289
*/
@@ -389,7 +391,7 @@ public function isPositive(): bool
389
391
* Multiply this Decimal by $value and return the product as a new Decimal.
390
392
*
391
393
* @param static|string|float|int $value
392
- * @param int|null $scale Leave empty to auto-detect .
394
+ * @param int|null $scale Decimal places in the result. Omit to enable auto-detection .
393
395
*
394
396
* @return static
395
397
*/
@@ -407,7 +409,7 @@ public function multiply(self|string|int|float $value, ?int $scale = null): stat
407
409
* Divide this Decimal by $value and return the quotient as a new Decimal.
408
410
*
409
411
* @param static|string|float|int $value
410
- * @param int $scale
412
+ * @param int $scale Decimal places in the result
411
413
*
412
414
* @throws \DivisionByZeroError if $value is zero.
413
415
*
@@ -427,7 +429,7 @@ public function divide(self|string|int|float $value, int $scale): static
427
429
* This method is equivalent to the ** operator.
428
430
*
429
431
* @param static|string|int $exponent
430
- * @param int|null $scale Leave empty to use current .
432
+ * @param int|null $scale Decimal places in the result. Omit to enable auto-detection .
431
433
*
432
434
* @return static
433
435
*/
@@ -443,7 +445,7 @@ public function pow(self|string|int $exponent, ?int $scale = null): static
443
445
/**
444
446
* Returns the square root of this decimal, with the same scale as this decimal.
445
447
*
446
- * @param int|null $scale Leave empty to use current .
448
+ * @param int|null $scale Decimal places in the result. Omit to enable auto-detection .
447
449
*
448
450
* @return static
449
451
*/
@@ -460,7 +462,7 @@ public function sqrt(?int $scale = null): static
460
462
* This method is equivalent to the % operator.
461
463
*
462
464
* @param static|string|int $value
463
- * @param int|null $scale Leave empty to use current .
465
+ * @param int|null $scale Decimal places in the result. Omit to enable auto-detection .
464
466
*
465
467
* @return static
466
468
*/
@@ -474,7 +476,7 @@ public function mod(self|string|int $value, ?int $scale = null): static
474
476
}
475
477
476
478
/**
477
- * @param int $scale
479
+ * @param int $scale Decimal places in the result (only used with mode "half up")
478
480
* @param int $roundMode
479
481
*
480
482
* @return static
@@ -524,7 +526,7 @@ public function ceil(): static
524
526
/**
525
527
* The result of discarding all digits behind the defined scale.
526
528
*
527
- * @param int $scale
529
+ * @param int $scale Decimal places in the result
528
530
*
529
531
* @throws \InvalidArgumentException
530
532
*
0 commit comments