Passed
Push — master ( a94b8a...621c3c )
by Jordan
21:05 queued 14:22
created
src/Samsara/Fermat/Provider/ConstantProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
             return self::$pi->truncateToScale($digits)->getValue(NumberBase::Ten);
37 37
         }
38 38
 
39
-        $internalScale = $digits + 10;
39
+        $internalScale = $digits+10;
40 40
 
41 41
         $C = Numbers::make(Numbers::IMMUTABLE, '10005', $internalScale)->setMode(CalcMode::Precision)->sqrt($internalScale)->multiply(426880);
42 42
         $M = Numbers::make(Numbers::IMMUTABLE, '1', $internalScale)->setMode(CalcMode::Precision);
43 43
         $L = Numbers::make(Numbers::IMMUTABLE, '13591409', $internalScale)->setMode(CalcMode::Precision);
44 44
         $K = Numbers::make(Numbers::IMMUTABLE, '6', $internalScale)->setMode(CalcMode::Precision);
45 45
         $X = Numbers::make(Numbers::IMMUTABLE, '1')->setMode(CalcMode::Precision);
46
-        $sum = Numbers::make(Numbers::MUTABLE,'0', $internalScale + 2)->setMode(CalcMode::Precision);
46
+        $sum = Numbers::make(Numbers::MUTABLE, '0', $internalScale+2)->setMode(CalcMode::Precision);
47 47
         $termNum = 0;
48 48
         $one = Numbers::makeOne($internalScale)->setMode(CalcMode::Precision);
49 49
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             return self::$e->truncateToScale($digits)->getValue(NumberBase::Ten);
96 96
         }
97 97
 
98
-        $internalScale = $digits + 3;
98
+        $internalScale = $digits+3;
99 99
 
100 100
         $one = Numbers::makeOne($internalScale+5)->setMode(CalcMode::Precision);
101 101
         $denominator = Numbers::make(Numbers::MUTABLE, '1', $internalScale)->setMode(CalcMode::Precision);
Please login to merge, or discard this patch.
src/Samsara/Fermat/Numbers.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @return ImmutableDecimal|MutableDecimal|NumberInterface|ImmutableDecimal[]|MutableDecimal[]|NumberInterface[]
115 115
      * @throws IntegrityConstraint
116 116
      */
117
-    public static function makeOrDont(string|object $type, mixed $value, ?int $scale = null, NumberBase $base = NumberBase::Ten)
117
+    public static function makeOrDont(string | object $type, mixed $value, ?int $scale = null, NumberBase $base = NumberBase::Ten)
118 118
     {
119 119
 
120 120
         if (is_object($value)) {
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             }
237 237
 
238 238
             if ($scale > 100) {
239
-                $pi = self::make(self::IMMUTABLE, ConstantProvider::makePi($scale), $scale + 2);
239
+                $pi = self::make(self::IMMUTABLE, ConstantProvider::makePi($scale), $scale+2);
240 240
                 /** @var ImmutableDecimal */
241 241
                 return $pi->multiply(2)->truncateToScale($scale);
242 242
             }
Please login to merge, or discard this patch.
Samsara/Fermat/Types/Traits/Trigonometry/InverseTrigonometryScaleTrait.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
         } else {
44 44
             $abs = $this instanceof ImmutableDecimal ? $this->abs() : new ImmutableDecimal($this->absValue());
45 45
             $addScale = $abs->asInt() > $abs->getScale() ? $abs->asInt() : $abs->getScale();
46
-            $intScale = $scale + $addScale;
46
+            $intScale = $scale+$addScale;
47 47
             $x = new ImmutableDecimal($this->getValue(NumberBase::Ten), $intScale);
48 48
             $x2 = $x->pow(2);
49 49
             $one = new ImmutableDecimal(1, $intScale);
50 50
 
51
-            $aPart = new class($x2, $intScale) implements ContinuedFractionTermInterface{
51
+            $aPart = new class($x2, $intScale) implements ContinuedFractionTermInterface {
52 52
                 private ImmutableDecimal $x2;
53 53
                 private ImmutableDecimal $negTwo;
54 54
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                 }
77 77
             };
78 78
 
79
-            $bPart = new class() implements ContinuedFractionTermInterface{
79
+            $bPart = new class() implements ContinuedFractionTermInterface {
80 80
                 /**
81 81
                  * @param int $n
82 82
                  * @return ImmutableDecimal
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         } elseif ($this->isEqual(1)) {
118 118
             $answer = Numbers::makeZero();
119 119
         } else {
120
-            $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $scale + 2);
120
+            $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $scale+2);
121 121
 
122 122
             $answer = $piDivTwo->subtract($z->arcsin($scale+2));
123 123
         }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
         $scale = $scale ?? $this->getScale();
140 140
         $abs = $this instanceof ImmutableDecimal ? $this->abs() : new ImmutableDecimal($this->absValue());
141
-        $intScale = $scale + 2;
141
+        $intScale = $scale+2;
142 142
         $terms = $abs->multiply($intScale+8)->asInt();
143 143
         $x = new ImmutableDecimal($this->getValue(NumberBase::Ten), $intScale);
144 144
         $aPart = new class($x) implements ContinuedFractionTermInterface {
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
                     return Numbers::makeZero($this->intScale);
188 188
                 }
189 189
 
190
-                return SequenceProvider::nthOddNumber($n - 1)->truncateToScale($this->intScale);
190
+                return SequenceProvider::nthOddNumber($n-1)->truncateToScale($this->intScale);
191 191
             }
192 192
         };
193 193
 
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 
209 209
         $scale = $scale ?? $this->getScale();
210 210
 
211
-        $piDivTwo = Numbers::makePi($scale + 2)->divide(2, $scale + 2);
211
+        $piDivTwo = Numbers::makePi($scale+2)->divide(2, $scale+2);
212 212
 
213
-        $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $scale + 2);
213
+        $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $scale+2);
214 214
 
215 215
         $arctan = $z->arctan($scale+2, false);
216 216
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     {
230 230
 
231 231
         $scale = $scale ?? $this->getScale();
232
-        $intScale = $scale + 2;
232
+        $intScale = $scale+2;
233 233
 
234 234
         $one = Numbers::makeOne($intScale);
235 235
         $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this->getValue(NumberBase::Ten), $intScale);
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         $answer = SeriesProvider::generalizedContinuedFraction(
288 288
             $aPart,
289 289
             $bPart,
290
-            $intScale * 2,
290
+            $intScale*2,
291 291
             $intScale,
292 292
             SeriesProvider::SUM_MODE_SUB
293 293
         );
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     {
306 306
 
307 307
         $scale = $scale ?? $this->getScale();
308
-        $intScale = $scale + 2;
308
+        $intScale = $scale+2;
309 309
 
310 310
         $one = Numbers::makeOne($intScale);
311 311
         $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $intScale);
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
         $answer = SeriesProvider::generalizedContinuedFraction(
361 361
             $aPart,
362 362
             $bPart,
363
-            $intScale * 2,
363
+            $intScale*2,
364 364
             $intScale,
365 365
             SeriesProvider::SUM_MODE_ALT_FIRST_ADD
366 366
         );
Please login to merge, or discard this patch.
src/Samsara/Fermat/Provider/SeriesProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@
 block discarded – undo
176 176
         $prevDenominator = new ImmutableDecimal(0, $scale);
177 177
         $loop = 0;
178 178
 
179
-        for ($i = $terms;$i > 0;$i--) {
179
+        for ($i = $terms; $i > 0; $i--) {
180 180
             $loop++;
181 181
             switch ($sumMode) {
182 182
                 case self::SUM_MODE_ADD:
Please login to merge, or discard this patch.
tests-bench/src/Samsara/Fermat/BareNativeBench.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     #[Revs(100000)]
13 13
     public function benchBareNativeBinaryOp()
14 14
     {
15
-        3 + 2;
15
+        3+2;
16 16
     }
17 17
 
18 18
     #[Groups(['arithmetic', 'bare-native'])]
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Traits/Arithmetic/ArithmeticScaleTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
         if (!$num->isWhole() && !extension_loaded('decimal')) {
87 87
             $scale += 1;
88 88
             $exponent = $num->multiply($thisNum->ln($scale));
89
-            return $exponent->exp($scale)->truncateToScale($scale - 1)->getValue(NumberBase::Ten);
89
+            return $exponent->exp($scale)->truncateToScale($scale-1)->getValue(NumberBase::Ten);
90 90
         }
91 91
 
92 92
         return ArithmeticProvider::pow($this->asReal(), $num->asReal(), $scale);
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Traits/Arithmetic/ArithmeticGMPTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
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 (function_exists('gmp_add') && function_exists('gmp_strval') && $this->extensions) {
22 22
             if ($this->isInt() && $num->isInt()) {
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param DecimalInterface $num
34 34
      * @return string|false
35 35
      */
36
-    protected function subtractGMP(DecimalInterface $num): string|false
36
+    protected function subtractGMP(DecimalInterface $num): string | false
37 37
     {
38 38
         if (function_exists('gmp_sub') && function_exists('gmp_strval') && $this->extensions) {
39 39
             if ($this->isInt() && $num->isInt()) {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      * @param DecimalInterface $num
51 51
      * @return string|false
52 52
      */
53
-    protected function multiplyGMP(DecimalInterface $num): string|false
53
+    protected function multiplyGMP(DecimalInterface $num): string | false
54 54
     {
55 55
         if (function_exists('gmp_mul') && function_exists('gmp_strval') && $this->extensions) {
56 56
             if ($this->isInt() && $num->isInt()) {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      * @param DecimalInterface $num
68 68
      * @return string|false
69 69
      */
70
-    protected function divideGMP(DecimalInterface $num): string|false
70
+    protected function divideGMP(DecimalInterface $num): string | false
71 71
     {
72 72
         if (function_exists('gmp_div_qr') && function_exists('gmp_strval') && $this->extensions) {
73 73
             if ($this->isInt() && $num->isInt()) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @param DecimalInterface $num
92 92
      * @return string|false
93 93
      */
94
-    protected function powGMP(DecimalInterface $num): string|false
94
+    protected function powGMP(DecimalInterface $num): string | false
95 95
     {
96 96
         if (function_exists('gmp_pow') && function_exists('gmp_strval') && $this->extensions) {
97 97
             if ($this->isInt() && $num->isInt() && $num->isPositive()) {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     /**
108 108
      * @return string|false
109 109
      */
110
-    protected function sqrtGMP(): string|false
110
+    protected function sqrtGMP(): string | false
111 111
     {
112 112
         if (function_exists('gmp_sqrtrem') && function_exists('gmp_strval') && $this->extensions) {
113 113
             if ($this->isInt() && $this->isLessThan(PHP_INT_MAX) && $this->isGreaterThan(PHP_INT_MIN)) {
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Traits/IntegerMathTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         $curVal = $this->getValue(NumberBase::Ten);
54 54
         $calcVal = Numbers::make(Numbers::IMMUTABLE, 1);
55 55
 
56
-        for ($i = 1;$i <= $curVal;$i++) {
56
+        for ($i = 1; $i <= $curVal; $i++) {
57 57
             $calcVal = $calcVal->multiply($i);
58 58
         }
59 59
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         }
248 248
 
249 249
         if (function_exists('gmp_prob_prime') && $this->extensions) {
250
-            return (bool)gmp_prob_prime($this->getValue(NumberBase::Ten), $certainty);
250
+            return (bool) gmp_prob_prime($this->getValue(NumberBase::Ten), $certainty);
251 251
         }
252 252
 
253 253
         $thisNum = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $this->getScale());
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
 
264 264
         $r = $r->subtract(1);
265 265
 
266
-        for ($i = 0;$i < $certainty;$i++) {
266
+        for ($i = 0; $i < $certainty; $i++) {
267 267
             $a = RandomProvider::randomInt(2, $s, RandomMode::Speed);
268 268
             $x = $a->pow($d)->modulo($thisNum);
269 269
             if ($x->isEqual(1) || $x->isEqual($s)) {
270 270
                 continue;
271 271
             }
272
-            for ($j = 0;$j < $r->asInt();$j++) {
272
+            for ($j = 0; $j < $r->asInt(); $j++) {
273 273
                 $x = $x->pow(2)->modulo($thisNum);
274 274
                 if ($x->isEqual($s)) {
275 275
                     continue 2;
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Traits/Decimal/LogScaleTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
         } else {
43 43
             $x = $this instanceof ImmutableDecimal ? $this : new ImmutableDecimal($this->getValue(NumberBase::Ten));
44 44
             $x2 = $x->pow(2);
45
-            $intScale = $scale + 1;
45
+            $intScale = $scale+1;
46 46
             $terms = $scale;
47 47
             $six = new ImmutableDecimal(6);
48 48
 
49
-            $aPart = new class($x2, $x) implements ContinuedFractionTermInterface{
49
+            $aPart = new class($x2, $x) implements ContinuedFractionTermInterface {
50 50
                 private ImmutableDecimal $x2;
51 51
                 private ImmutableDecimal $x;
52 52
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                 }
75 75
             };
76 76
 
77
-            $bPart = new class($x, $six) implements ContinuedFractionTermInterface{
77
+            $bPart = new class($x, $six) implements ContinuedFractionTermInterface {
78 78
                 private ImmutableDecimal $x;
79 79
                 private ImmutableDecimal $six;
80 80
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         $answer = $adjustedNum;
183 183
 
184 184
         if ($exp2) {
185
-            $answer = $answer->add(Numbers::makeNaturalLog2($internalScale + $exp2)->multiply($exp2));
185
+            $answer = $answer->add(Numbers::makeNaturalLog2($internalScale+$exp2)->multiply($exp2));
186 186
         }
187 187
 
188 188
         if ($exp1p1) {
Please login to merge, or discard this patch.