@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | * @throws IncompatibleObjectState |
31 | 31 | */ |
32 | 32 | public static function randomInt( |
33 | - int|string|DecimalInterface $min, |
|
34 | - int|string|DecimalInterface $max, |
|
33 | + int | string | DecimalInterface $min, |
|
34 | + int | string | DecimalInterface $max, |
|
35 | 35 | RandomMode $mode = RandomMode::Entropy |
36 | 36 | ): ImmutableDecimal |
37 | 37 | { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | throw new OptionalExit( |
108 | 108 | 'System error from random_bytes().', |
109 | 109 | 'Ensure your system is configured correctly.', |
110 | - 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: ' . $e->getMessage() |
|
110 | + 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: '.$e->getMessage() |
|
111 | 111 | ); |
112 | 112 | } |
113 | 113 | } elseif ($mode == RandomMode::Speed) { |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | */ |
148 | 148 | $entropyBytes = random_bytes($bytesNeeded->asInt()); |
149 | 149 | $baseTwoBytes = ''; |
150 | - for($i = 0; $i < strlen($entropyBytes); $i++){ |
|
151 | - $baseTwoBytes .= decbin( ord( $entropyBytes[$i] ) ); |
|
150 | + for ($i = 0;$i < strlen($entropyBytes);$i++) { |
|
151 | + $baseTwoBytes .= decbin(ord($entropyBytes[$i])); |
|
152 | 152 | } |
153 | 153 | } catch (Exception $e) { |
154 | 154 | throw new OptionalExit( |
155 | 155 | 'System error from random_bytes().', |
156 | 156 | 'Ensure your system is configured correctly.', |
157 | - 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: ' . $e->getMessage() |
|
157 | + 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: '.$e->getMessage() |
|
158 | 158 | ); |
159 | 159 | } |
160 | 160 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | * @throws IncompatibleObjectState |
244 | 244 | */ |
245 | 245 | public static function randomReal( |
246 | - int|string|DecimalInterface $min, |
|
247 | - int|string|DecimalInterface $max, |
|
246 | + int | string | DecimalInterface $min, |
|
247 | + int | string | DecimalInterface $max, |
|
248 | 248 | int $scale, |
249 | 249 | RandomMode $mode = RandomMode::Entropy |
250 | 250 | ): ImmutableDecimal |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * We cannot take advantage of a more efficient check for the top end of the range, so the |
370 | 370 | * less than check is all we need. |
371 | 371 | */ |
372 | - $maxDecimal = str_pad('1', $scale + 1, '0'); |
|
372 | + $maxDecimal = str_pad('1', $scale+1, '0'); |
|
373 | 373 | } else { |
374 | 374 | /** |
375 | 375 | * The max value is guaranteed to have a decimal portion here since we excluded max being |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $roundedPartString = $wholePart; |
141 | 141 | $otherPart = str_split($decimalPart); |
142 | 142 | $baseLength = strlen($wholePart); |
143 | - $pos = ($absPlaces >= $baseLength) ? 0 : $baseLength + $places; |
|
143 | + $pos = ($absPlaces >= $baseLength) ? 0 : $baseLength+$places; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return [ |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | bool $currentPart |
215 | 215 | ): array |
216 | 216 | { |
217 | - $digit = (int)$roundedPart[$pos] + $carry; |
|
217 | + $digit = (int)$roundedPart[$pos]+$carry; |
|
218 | 218 | |
219 | 219 | if ($carry == 0 && $digit == 5 && strlen($roundedPartString) > $pos+1) { |
220 | 220 | $remainder = substr($roundedPartString, $pos+1); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $number = str_replace('-', '-'.$currency->value, $number); |
34 | 34 | $number = str_replace('+', '+'.$currency->value, $number); |
35 | 35 | } else { |
36 | - $number = $currency->value . $number; |
|
36 | + $number = $currency->value.$number; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return $number; |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | $number = $wholePart; |
72 | 72 | |
73 | 73 | if ($decimalPart) { |
74 | - $number .= self::getRadixCharacter($format) . $decimalPart; |
|
74 | + $number .= self::getRadixCharacter($format).$decimalPart; |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | 78 | if (str_contains($posNegChar, '\N')) { |
79 | 79 | $number = str_replace('\N', $number, $posNegChar); |
80 | 80 | } else { |
81 | - $number = $posNegChar . $number; |
|
81 | + $number = $posNegChar.$number; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $number; |
@@ -107,17 +107,17 @@ discard block |
||
107 | 107 | if ($wholeSizeNonZero) { |
108 | 108 | $exponent = $wholeSizeNonZero; |
109 | 109 | $exponent -= 1; |
110 | - $mantissa = substr($wholePart, 0, 1) . '.' . substr($wholePart, 1) . $decimalPart; |
|
110 | + $mantissa = substr($wholePart, 0, 1).'.'.substr($wholePart, 1).$decimalPart; |
|
111 | 111 | } else { |
112 | - $exponent = strlen($decimalPart) - $decimalSizeNonZero; |
|
112 | + $exponent = strlen($decimalPart)-$decimalSizeNonZero; |
|
113 | 113 | $exponent += 1; |
114 | - $mantissa = substr($decimalPart, $exponent-1, 1) . '.' . substr($decimalPart, $exponent); |
|
114 | + $mantissa = substr($decimalPart, $exponent-1, 1).'.'.substr($decimalPart, $exponent); |
|
115 | 115 | $exponent *= -1; |
116 | 116 | } |
117 | 117 | |
118 | 118 | $mantissa = rtrim($mantissa, '0'); |
119 | 119 | |
120 | - return $negative . $mantissa . 'E' . $exponent . $imaginary; |
|
120 | + return $negative.$mantissa.'E'.$exponent.$imaginary; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | $formatted = ''; |
138 | 138 | |
139 | 139 | for ($i = 0;$i < count($numberArr);$i++) { |
140 | - $j = $i + 1; |
|
140 | + $j = $i+1; |
|
141 | 141 | |
142 | 142 | $formatted = $numberArr[$i].$formatted; |
143 | 143 | |
144 | 144 | if ($grouping == NumberGrouping::Standard) { |
145 | - if ($j % 3 == 0 && array_key_exists($i+1, $numberArr)) { |
|
145 | + if ($j%3 == 0 && array_key_exists($i+1, $numberArr)) { |
|
146 | 146 | $formatted = self::getDelimiterCharacter($format).$formatted; |
147 | 147 | } |
148 | 148 | } elseif ($grouping == NumberGrouping::Indian) { |
149 | 149 | if ($j == 3 && array_key_exists($i+1, $numberArr)) { |
150 | 150 | $formatted = self::getDelimiterCharacter($format).$formatted; |
151 | - } elseif (($j - 3) % 2 == 0 && ($j - 3) > 0 && array_key_exists($i+1, $numberArr)) { |
|
151 | + } elseif (($j-3)%2 == 0 && ($j-3) > 0 && array_key_exists($i+1, $numberArr)) { |
|
152 | 152 | $formatted = self::getDelimiterCharacter($format).$formatted; |
153 | 153 | } |
154 | 154 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $baseValue = $this->trimmedScientificString($scale, $baseValue); |
124 | 124 | |
125 | 125 | if ($this->isNegative()) { |
126 | - $baseValue = '-' . $baseValue; |
|
126 | + $baseValue = '-'.$baseValue; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | if ($this->isImaginary()) { |
@@ -141,18 +141,18 @@ discard block |
||
141 | 141 | */ |
142 | 142 | private function trimmedScientificString(int $scale, string $baseValue): string |
143 | 143 | { |
144 | - if ($this->numberOfIntDigits() > $scale + 1) { |
|
145 | - $baseValue = substr($this->getWholePart(), 0, $scale + 1); |
|
144 | + if ($this->numberOfIntDigits() > $scale+1) { |
|
145 | + $baseValue = substr($this->getWholePart(), 0, $scale+1); |
|
146 | 146 | $baseValue = str_pad($baseValue, $this->numberOfIntDigits(), '0'); |
147 | - } elseif ($this->getWholePart() == '0' && $this->numberOfSigDecimalDigits() > $scale + 1) { |
|
147 | + } elseif ($this->getWholePart() == '0' && $this->numberOfSigDecimalDigits() > $scale+1) { |
|
148 | 148 | $baseValue = trim($this->getDecimalPart(), '0'); |
149 | - $baseValue = substr($baseValue, 0, $scale + 1); |
|
150 | - $baseValue = str_pad($baseValue, $this->numberOfLeadingZeros() + strlen($baseValue), '0', STR_PAD_LEFT); |
|
151 | - $baseValue = '0.' . $baseValue; |
|
152 | - } elseif ($this->numberOfTotalDigits() > $scale + 1) { |
|
149 | + $baseValue = substr($baseValue, 0, $scale+1); |
|
150 | + $baseValue = str_pad($baseValue, $this->numberOfLeadingZeros()+strlen($baseValue), '0', STR_PAD_LEFT); |
|
151 | + $baseValue = '0.'.$baseValue; |
|
152 | + } elseif ($this->numberOfTotalDigits() > $scale+1) { |
|
153 | 153 | $baseValue = $this->getWholePart() |
154 | 154 | . '.' |
155 | - . substr($this->getDecimalPart(), 0, ($scale + 1) - $this->numberOfIntDigits()); |
|
155 | + . substr($this->getDecimalPart(), 0, ($scale+1)-$this->numberOfIntDigits()); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | return $baseValue; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param DecimalInterface $num |
17 | 17 | * @return string|false |
18 | 18 | */ |
19 | - protected function addGMP(DecimalInterface $num): string|false |
|
19 | + protected function addGMP(DecimalInterface $num): string | false |
|
20 | 20 | { |
21 | 21 | if ($this->isInt() && $num->isInt()) { |
22 | 22 | $result = gmp_add($this->getAsBaseTenRealNumber(), $num->getAsBaseTenRealNumber()); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param DecimalInterface $num |
32 | 32 | * @return string|false |
33 | 33 | */ |
34 | - protected function subtractGMP(DecimalInterface $num): string|false |
|
34 | + protected function subtractGMP(DecimalInterface $num): string | false |
|
35 | 35 | { |
36 | 36 | if ($this->isInt() && $num->isInt()) { |
37 | 37 | $result = gmp_sub($this->getAsBaseTenRealNumber(), $num->getAsBaseTenRealNumber()); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param DecimalInterface $num |
47 | 47 | * @return string|false |
48 | 48 | */ |
49 | - protected function multiplyGMP(DecimalInterface $num): string|false |
|
49 | + protected function multiplyGMP(DecimalInterface $num): string | false |
|
50 | 50 | { |
51 | 51 | if ($this->isInt() && $num->isInt()) { |
52 | 52 | $result = gmp_mul($this->getAsBaseTenRealNumber(), $num->getAsBaseTenRealNumber()); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param DecimalInterface $num |
62 | 62 | * @return string|false |
63 | 63 | */ |
64 | - protected function divideGMP(DecimalInterface $num): string|false |
|
64 | + protected function divideGMP(DecimalInterface $num): string | false |
|
65 | 65 | { |
66 | 66 | if ($this->isInt() && $num->isInt()) { |
67 | 67 | $result = gmp_div_qr($this->getAsBaseTenRealNumber(), $num->getAsBaseTenRealNumber()); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param DecimalInterface $num |
79 | 79 | * @return string|false |
80 | 80 | */ |
81 | - protected function powGMP(DecimalInterface $num): string|false |
|
81 | + protected function powGMP(DecimalInterface $num): string | false |
|
82 | 82 | { |
83 | 83 | if ($this->isInt() && $num->isInt() && $num->isPositive()) { |
84 | 84 | $result = gmp_pow($this->getAsBaseTenRealNumber(), $num->getAsBaseTenRealNumber()); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | /** |
93 | 93 | * @return string|false |
94 | 94 | */ |
95 | - protected function sqrtGMP(): string|false |
|
95 | + protected function sqrtGMP(): string | false |
|
96 | 96 | { |
97 | 97 | if ($this->isInt()) { |
98 | 98 | $result = gmp_sqrtrem($this->getAsBaseTenRealNumber()); |
@@ -20,57 +20,57 @@ discard block |
||
20 | 20 | { |
21 | 21 | |
22 | 22 | const EULER_ZIGZAG = [ |
23 | - '1', // 0 |
|
24 | - '1', // 1 |
|
25 | - '1', // 2 |
|
26 | - '2', // 3 |
|
27 | - '5', // 4 |
|
28 | - '16', // 5 |
|
29 | - '61', // 6 |
|
30 | - '272', // 7 |
|
31 | - '1385', // 8 |
|
32 | - '7936', // 9 |
|
33 | - '50521', // 10 |
|
34 | - '353792', // 11 |
|
35 | - '2702765', // 12 |
|
36 | - '22368256', // 13 |
|
37 | - '199360981', // 14 |
|
38 | - '1903757312', // 15 |
|
39 | - '19391512145', // 16 |
|
40 | - '209865342976', // 17 |
|
41 | - '2404879675441', // 18 |
|
42 | - '29088885112832', // 19 |
|
43 | - '370371188237525', // 20 |
|
44 | - '4951498053124096', // 21 |
|
45 | - '69348874393137901', // 22 |
|
46 | - '1015423886506852352', // 23 |
|
47 | - '15514534163557086905', // 24 |
|
48 | - '246921480190207983616', // 25 |
|
49 | - '4087072509293123892361', // 26 |
|
50 | - '70251601603943959887872', // 27 |
|
51 | - '1252259641403629865468285', // 28 |
|
52 | - '23119184187809597841473536', // 29 |
|
53 | - '441543893249023104553682821', // 30 |
|
54 | - '8713962757125169296170811392', // 31 |
|
55 | - '177519391579539289436664789665', // 32 |
|
56 | - '3729407703720529571097509625856', // 33 |
|
57 | - '80723299235887898062168247453281', // 34 |
|
58 | - '1798651693450888780071750349094912', // 35 |
|
59 | - '41222060339517702122347079671259045', // 36 |
|
60 | - '970982810785059112379399707952152576', // 37 |
|
61 | - '23489580527043108252017828576198947741', // 38 |
|
62 | - '583203324917310043943191641625494290432', // 39 |
|
63 | - '14851150718114980017877156781405826684425', // 40 |
|
64 | - '387635983772083031828014624002175135645696', // 41 |
|
65 | - '10364622733519612119397957304745185976310201', // 42 |
|
66 | - '283727921907431909304183316295787837183229952', // 43 |
|
67 | - '7947579422597592703608040510088070619519273805', // 44 |
|
68 | - '227681379129930886488600284336316164603920777216', // 45 |
|
69 | - '6667537516685544977435028474773748197524107684661', // 46 |
|
70 | - '199500252157859031027160499643195658166340757225472', // 47 |
|
71 | - '6096278645568542158691685742876843153976539044435185', // 48 |
|
72 | - '190169564657928428175235445073924928592047775873499136', // 49 |
|
73 | - '6053285248188621896314383785111649088103498225146815121', // 50 |
|
23 | + '1', // 0 |
|
24 | + '1', // 1 |
|
25 | + '1', // 2 |
|
26 | + '2', // 3 |
|
27 | + '5', // 4 |
|
28 | + '16', // 5 |
|
29 | + '61', // 6 |
|
30 | + '272', // 7 |
|
31 | + '1385', // 8 |
|
32 | + '7936', // 9 |
|
33 | + '50521', // 10 |
|
34 | + '353792', // 11 |
|
35 | + '2702765', // 12 |
|
36 | + '22368256', // 13 |
|
37 | + '199360981', // 14 |
|
38 | + '1903757312', // 15 |
|
39 | + '19391512145', // 16 |
|
40 | + '209865342976', // 17 |
|
41 | + '2404879675441', // 18 |
|
42 | + '29088885112832', // 19 |
|
43 | + '370371188237525', // 20 |
|
44 | + '4951498053124096', // 21 |
|
45 | + '69348874393137901', // 22 |
|
46 | + '1015423886506852352', // 23 |
|
47 | + '15514534163557086905', // 24 |
|
48 | + '246921480190207983616', // 25 |
|
49 | + '4087072509293123892361', // 26 |
|
50 | + '70251601603943959887872', // 27 |
|
51 | + '1252259641403629865468285', // 28 |
|
52 | + '23119184187809597841473536', // 29 |
|
53 | + '441543893249023104553682821', // 30 |
|
54 | + '8713962757125169296170811392', // 31 |
|
55 | + '177519391579539289436664789665', // 32 |
|
56 | + '3729407703720529571097509625856', // 33 |
|
57 | + '80723299235887898062168247453281', // 34 |
|
58 | + '1798651693450888780071750349094912', // 35 |
|
59 | + '41222060339517702122347079671259045', // 36 |
|
60 | + '970982810785059112379399707952152576', // 37 |
|
61 | + '23489580527043108252017828576198947741', // 38 |
|
62 | + '583203324917310043943191641625494290432', // 39 |
|
63 | + '14851150718114980017877156781405826684425', // 40 |
|
64 | + '387635983772083031828014624002175135645696', // 41 |
|
65 | + '10364622733519612119397957304745185976310201', // 42 |
|
66 | + '283727921907431909304183316295787837183229952', // 43 |
|
67 | + '7947579422597592703608040510088070619519273805', // 44 |
|
68 | + '227681379129930886488600284336316164603920777216', // 45 |
|
69 | + '6667537516685544977435028474773748197524107684661', // 46 |
|
70 | + '199500252157859031027160499643195658166340757225472', // 47 |
|
71 | + '6096278645568542158691685742876843153976539044435185', // 48 |
|
72 | + '190169564657928428175235445073924928592047775873499136', // 49 |
|
73 | + '6053285248188621896314383785111649088103498225146815121', // 50 |
|
74 | 74 | ]; |
75 | 75 | |
76 | 76 | /** |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | * @throws IntegrityConstraint |
85 | 85 | * @throws MissingPackage |
86 | 86 | */ |
87 | - public static function nthOddNumber(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal|NumberCollection |
|
87 | + public static function nthOddNumber(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal | NumberCollection |
|
88 | 88 | { |
89 | 89 | if ($asCollection) { |
90 | 90 | $sequence = new NumberCollection(); |
91 | 91 | |
92 | 92 | for ($i = 0;$i < $collectionSize;$i++) { |
93 | - $sequence->push(self::nthOddNumber($n + $i)); |
|
93 | + $sequence->push(self::nthOddNumber($n+$i)); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | return $sequence; |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | * @return ImmutableDecimal|NumberCollection |
118 | 118 | * @throws IntegrityConstraint |
119 | 119 | */ |
120 | - public static function nthEvenNumber(int $n, int $scale = null, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal|NumberCollection |
|
120 | + public static function nthEvenNumber(int $n, int $scale = null, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal | NumberCollection |
|
121 | 121 | { |
122 | 122 | |
123 | 123 | if ($asCollection) { |
124 | 124 | $sequence = new NumberCollection(); |
125 | 125 | |
126 | 126 | for ($i = 0;$i < $collectionSize;$i++) { |
127 | - $sequence->push(self::nthEvenNumber($n + $i)); |
|
127 | + $sequence->push(self::nthEvenNumber($n+$i)); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | return $sequence; |
@@ -149,20 +149,20 @@ discard block |
||
149 | 149 | * @return ImmutableDecimal|NumberCollection |
150 | 150 | * @throws IntegrityConstraint |
151 | 151 | */ |
152 | - public static function nthPowerNegativeOne(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal|NumberCollection |
|
152 | + public static function nthPowerNegativeOne(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal | NumberCollection |
|
153 | 153 | { |
154 | 154 | |
155 | 155 | if ($asCollection) { |
156 | 156 | $sequence = new NumberCollection(); |
157 | 157 | |
158 | 158 | for ($i = 0;$i < $collectionSize;$i++) { |
159 | - $sequence->push(self::nthPowerNegativeOne($n + $i)); |
|
159 | + $sequence->push(self::nthPowerNegativeOne($n+$i)); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | return $sequence; |
163 | 163 | } |
164 | 164 | |
165 | - return ($n % 2 ? new ImmutableDecimal(-1) : new ImmutableDecimal(1)); |
|
165 | + return ($n%2 ? new ImmutableDecimal(-1) : new ImmutableDecimal(1)); |
|
166 | 166 | |
167 | 167 | } |
168 | 168 | |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | * @return ImmutableDecimal|NumberCollection |
177 | 177 | * @throws IntegrityConstraint |
178 | 178 | */ |
179 | - public static function nthEulerZigzag(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal|NumberCollection |
|
179 | + public static function nthEulerZigzag(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal | NumberCollection |
|
180 | 180 | { |
181 | 181 | |
182 | 182 | if ($asCollection) { |
183 | 183 | $sequence = new NumberCollection(); |
184 | 184 | |
185 | 185 | for ($i = 0;$i < $collectionSize;$i++) { |
186 | - $sequence->push(self::nthEulerZigzag($n + $i)); |
|
186 | + $sequence->push(self::nthEulerZigzag($n+$i)); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | return $sequence; |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * @return ImmutableDecimal|NumberCollection |
346 | 346 | * @throws IntegrityConstraint |
347 | 347 | */ |
348 | - public static function nthFibonacciNumber(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal|NumberCollection |
|
348 | + public static function nthFibonacciNumber(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal | NumberCollection |
|
349 | 349 | { |
350 | 350 | $n = Numbers::makeOrDont(Numbers::IMMUTABLE, $n); |
351 | 351 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @param DecimalInterface $num |
16 | 16 | * @return int|float |
17 | 17 | */ |
18 | - protected static function translateToNative(DecimalInterface $num): int|float |
|
18 | + protected static function translateToNative(DecimalInterface $num): int | float |
|
19 | 19 | { |
20 | 20 | return ($num->isInt() ? $num->asInt() : $num->asFloat()); |
21 | 21 | } |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @param DecimalInterface $num |
25 | 25 | * @return int|float |
26 | 26 | */ |
27 | - protected function addNative(DecimalInterface $num): int|float |
|
27 | + protected function addNative(DecimalInterface $num): int | float |
|
28 | 28 | { |
29 | 29 | $left = self::translateToNative($this); |
30 | 30 | $right = self::translateToNative($num); |
31 | 31 | |
32 | - $value = $left + $right; |
|
32 | + $value = $left+$right; |
|
33 | 33 | return (string)$value; |
34 | 34 | } |
35 | 35 | |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | * @param DecimalInterface $num |
38 | 38 | * @return int|float |
39 | 39 | */ |
40 | - protected function subtractNative(DecimalInterface $num): int|float |
|
40 | + protected function subtractNative(DecimalInterface $num): int | float |
|
41 | 41 | { |
42 | 42 | $left = self::translateToNative($this); |
43 | 43 | $right = self::translateToNative($num); |
44 | 44 | |
45 | - $value = $left - $right; |
|
45 | + $value = $left-$right; |
|
46 | 46 | return (string)$value; |
47 | 47 | } |
48 | 48 | |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | * @param DecimalInterface $num |
51 | 51 | * @return int|float |
52 | 52 | */ |
53 | - protected function multiplyNative(DecimalInterface $num): int|float |
|
53 | + protected function multiplyNative(DecimalInterface $num): int | float |
|
54 | 54 | { |
55 | 55 | $left = self::translateToNative($this); |
56 | 56 | $right = self::translateToNative($num); |
57 | 57 | |
58 | - $value = $left * $right; |
|
58 | + $value = $left*$right; |
|
59 | 59 | return (string)$value; |
60 | 60 | } |
61 | 61 | |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * @param DecimalInterface $num |
64 | 64 | * @return int|float |
65 | 65 | */ |
66 | - protected function divideNative(DecimalInterface $num): int|float |
|
66 | + protected function divideNative(DecimalInterface $num): int | float |
|
67 | 67 | { |
68 | 68 | $left = self::translateToNative($this); |
69 | 69 | $right = self::translateToNative($num); |
70 | 70 | |
71 | - $value = $left / $right; |
|
71 | + $value = $left/$right; |
|
72 | 72 | return (string)$value; |
73 | 73 | } |
74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param DecimalInterface $num |
77 | 77 | * @return int|float |
78 | 78 | */ |
79 | - protected function powNative(DecimalInterface $num): int|float |
|
79 | + protected function powNative(DecimalInterface $num): int | float |
|
80 | 80 | { |
81 | 81 | $left = self::translateToNative($this); |
82 | 82 | $right = self::translateToNative($num); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * @return int|float |
90 | 90 | */ |
91 | - protected function sqrtNative(): int|float |
|
91 | + protected function sqrtNative(): int | float |
|
92 | 92 | { |
93 | 93 | $value = sqrt($this->abs()->asFloat()); |
94 | 94 | return (string)$value; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @throws IntegrityConstraint |
72 | 72 | * @throws MissingPackage |
73 | 73 | */ |
74 | - protected static function stringSelector(string $input): ImmutableComplexNumber|ImmutableDecimal|ImmutableFraction |
|
74 | + protected static function stringSelector(string $input): ImmutableComplexNumber | ImmutableDecimal | ImmutableFraction |
|
75 | 75 | { |
76 | 76 | |
77 | 77 | $input = trim($input); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | NumberInterface $thatRealPart, |
165 | 165 | NumberInterface $thatImaginaryPart, |
166 | 166 | CalcOperation $operation |
167 | - ): static|ImmutableComplexNumber |
|
167 | + ): static | ImmutableComplexNumber |
|
168 | 168 | { |
169 | 169 | if (!(InstalledVersions::isInstalled('samsara/fermat-complex-numbers')) || !class_exists('Samsara\\Fermat\\Values\\ImmutableComplexNumber')) { |
170 | 170 | throw new MissingPackage( |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @throws IntegrityConstraint |
203 | 203 | * @throws MissingPackage |
204 | 204 | */ |
205 | - protected function helperAddSubFraction(ImmutableDecimal|ImmutableFraction $num, CalcOperation $operation): FractionInterface |
|
205 | + protected function helperAddSubFraction(ImmutableDecimal | ImmutableFraction $num, CalcOperation $operation): FractionInterface |
|
206 | 206 | { |
207 | 207 | if ($num instanceof FractionInterface && $this->getDenominator()->isEqual($num->getDenominator())) { |
208 | 208 | $finalDenominator = $this->getDenominator(); |