Skip to content

Commit 7625a4a

Browse files
committed
PHP CS Fixer configuration fine tuning
1 parent 8d7be96 commit 7625a4a

2 files changed

Lines changed: 31 additions & 6 deletions

File tree

.php-cs-fixer.dist.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,31 @@
55
return new PhpCsFixer\Config()
66
->setRules([
77
"@PER-CS" => true,
8+
"@PHP82Migration" => true,
9+
"class_attributes_separation" => [
10+
"elements" => [
11+
"const" => "one",
12+
"method" => "one",
13+
"property" => "one",
14+
"trait_import" => "none",
15+
],
16+
],
17+
"no_extra_blank_lines" => [
18+
"tokens" => ["extra", "throw", "use"],
19+
],
20+
"no_blank_lines_after_class_opening" => true,
21+
"no_blank_lines_after_phpdoc" => true,
22+
"no_closing_tag" => true,
23+
"no_empty_phpdoc" => true,
24+
"no_empty_statement" => true,
25+
26+
//'strict_param' => true,
27+
"array_indentation" => true,
28+
"array_syntax" => ["syntax" => "short"],
29+
"binary_operator_spaces" => [
30+
"default" => "single_space",
31+
"operators" => ["=>" => null],
32+
],
33+
"whitespace_after_comma_in_array" => true,
834
])
935
->setFinder($finder);

src/NormalDist.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function getMean(): float
2424
{
2525
return $this->mu;
2626
}
27+
2728
public function getMeanRounded(int $precision = 3): float
2829
{
2930
return round($this->getMean(), $precision);
@@ -34,6 +35,7 @@ public function getSigma(): float
3435
{
3536
return $this->sigma;
3637
}
38+
3739
public function getSigmaRounded(int $precision = 3): float
3840
{
3941
return round($this->getSigma(), $precision);
@@ -44,6 +46,7 @@ public function getMedian(): float
4446
{
4547
return $this->mu;
4648
}
49+
4750
public function getMedianRounded(int $precision = 3): float
4851
{
4952
return round($this->getMedian(), $precision);
@@ -54,6 +57,7 @@ public function getMode(): float
5457
{
5558
return $this->mu;
5659
}
60+
5761
public function getModeRounded(int $precision = 3): float
5862
{
5963
return round($this->getMode(), $precision);
@@ -64,6 +68,7 @@ public function getVariance(): float
6468
{
6569
return $this->sigma ** 2;
6670
}
71+
6772
public function getVarianceRounded(int $precision = 3): float
6873
{
6974
return round($this->getVariance(), $precision);
@@ -187,7 +192,6 @@ private function erf(float $z): float
187192
return $z >= 0 ? 1 - $tau : $tau - 1;
188193
}
189194

190-
191195
// A utility function to calculate the cumulative density function (CDF)
192196
public function cdf(float $x): float
193197
{
@@ -284,7 +288,6 @@ public function invCdfRounded(float $p, int $precision = 3): float
284288
return round($this->invCdf($p), $precision);
285289
}
286290

287-
288291
/**
289292
* Divides the normal distribution into n continuous intervals
290293
* with equal probability.
@@ -385,7 +388,6 @@ public function add(float|NormalDist $x2): NormalDist
385388
return new NormalDist($this->mu + $x2, $this->sigma);
386389
}
387390

388-
389391
/**
390392
* Subtracts a constant or another NormalDist instance from this distribution.
391393
*
@@ -408,7 +410,6 @@ public function subtract(float|NormalDist $x2): NormalDist
408410
return new NormalDist($this->mu - $x2, $this->sigma);
409411
}
410412

411-
412413
/**
413414
* Multiplies both the mean (mu) and standard deviation (sigma) by a constant.
414415
*
@@ -427,8 +428,6 @@ public function multiply(float $constant): NormalDist
427428
);
428429
}
429430

430-
431-
432431
/**
433432
* Divides both the mean (mu) and standard deviation (sigma) by a constant.
434433
*

0 commit comments

Comments
 (0)