Skip to content

Commit 05b40c6

Browse files
Merge pull request #103 from TheDragonCode/code-style-qla99h9
The code style has been fixed
2 parents e67346e + bb15d73 commit 05b40c6

13 files changed

Lines changed: 14 additions & 120 deletions

src/Benchmark.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public function __construct(
3838

3939
/**
4040
* Creates a new benchmark instance.
41-
*
42-
* @return static
4341
*/
4442
public static function make(): static
4543
{
@@ -50,7 +48,6 @@ public static function make(): static
5048
* Sets a callback to be executed before all iterations for each comparison.
5149
*
5250
* @param Closure(int|string $name): mixed $callback
53-
*
5451
* @return $this
5552
*/
5653
public function before(Closure $callback): static
@@ -64,7 +61,6 @@ public function before(Closure $callback): static
6461
* Sets a callback to be executed before each iteration.
6562
*
6663
* @param Closure(int|string $name, int<1, max> $iteration): mixed $callback
67-
*
6864
* @return $this
6965
*/
7066
public function beforeEach(Closure $callback): static
@@ -78,7 +74,6 @@ public function beforeEach(Closure $callback): static
7874
* Sets a callback to be executed after all iterations for each comparison.
7975
*
8076
* @param Closure(int|string $name): mixed $callback
81-
*
8277
* @return $this
8378
*/
8479
public function after(Closure $callback): static
@@ -92,7 +87,6 @@ public function after(Closure $callback): static
9287
* Sets a callback to be executed after each iteration.
9388
*
9489
* @param Closure(int|string $name, int<1, max> $iteration, float $time, float $memory): mixed $callback
95-
*
9690
* @return $this
9791
*/
9892
public function afterEach(Closure $callback): static
@@ -106,7 +100,6 @@ public function afterEach(Closure $callback): static
106100
* Sets the number of iterations for each comparison.
107101
*
108102
* @param int<1, max> $count
109-
*
110103
* @return $this
111104
*/
112105
public function iterations(int $count): static
@@ -120,7 +113,6 @@ public function iterations(int $count): static
120113
* Enables deviation calculation and sets the number of runs.
121114
*
122115
* @param int<2, max> $count
123-
*
124116
* @return $this
125117
*/
126118
public function deviations(int $count = 2): static
@@ -136,7 +128,6 @@ public function deviations(int $count = 2): static
136128
* Sets the rounding precision for time values.
137129
*
138130
* @param int<0, max>|null $precision The number of decimal places. Null means no rounding.
139-
*
140131
* @return $this
141132
*/
142133
public function round(?int $precision): static
@@ -162,7 +153,6 @@ public function disableProgressBar(): static
162153
* Registers callback functions for comparison.
163154
*
164155
* @param array|Closure ...$callbacks Callback functions or an array of callback functions for comparison.
165-
*
166156
* @return $this
167157
*/
168158
public function compare(array|Closure ...$callbacks): static
@@ -206,8 +196,6 @@ public function toConsole(): void
206196

207197
/**
208198
* Returns the assertion service for performing result checks.
209-
*
210-
* @return AssertService
211199
*/
212200
public function toAssert(): AssertService
213201
{
@@ -230,8 +218,6 @@ protected function perform(): void
230218

231219
/**
232220
* Transforms collected data into an array of results.
233-
*
234-
* @return array
235221
*/
236222
protected function mapResult(): array
237223
{
@@ -302,8 +288,6 @@ protected function withProgress(Closure $callback, int $total): void
302288
*
303289
* @param array $callbacks An array of callback functions.
304290
* @param int $multiplier The multiplier (number of runs).
305-
*
306-
* @return int
307291
*/
308292
protected function steps(array $callbacks, int $multiplier = 1): int
309293
{
@@ -354,8 +338,7 @@ protected function run(mixed $name, Closure $callback, ProgressBarView $progress
354338
*
355339
* @param Closure $callback The callback function to execute.
356340
* @param array $parameters Parameters to pass to the callback.
357-
*
358-
* @return array An array [time in milliseconds, memory in bytes].
341+
* @return array An array [time in milliseconds, memory in bytes].
359342
*/
360343
protected function call(Closure $callback, array $parameters = []): array
361344
{

src/Services/AssertService.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function __construct(
2323
*
2424
* @param float|null $from Start value is specified in milliseconds.
2525
* @param float|null $till End value is specified in milliseconds.
26-
*
2726
* @return $this
2827
*/
2928
public function toBeMinTime(?float $from = null, ?float $till = null): static
@@ -43,7 +42,6 @@ public function toBeMinTime(?float $from = null, ?float $till = null): static
4342
*
4443
* @param float|null $from Start value is specified in milliseconds.
4544
* @param float|null $till End value is specified in milliseconds.
46-
*
4745
* @return $this
4846
*/
4947
public function toBeMaxTime(?float $from = null, ?float $till = null): static
@@ -63,7 +61,6 @@ public function toBeMaxTime(?float $from = null, ?float $till = null): static
6361
*
6462
* @param float|null $from Start value is specified in milliseconds.
6563
* @param float|null $till End value is specified in milliseconds.
66-
*
6764
* @return $this
6865
*/
6966
public function toBeAvgTime(?float $from = null, ?float $till = null): static
@@ -83,7 +80,6 @@ public function toBeAvgTime(?float $from = null, ?float $till = null): static
8380
*
8481
* @param float|null $from Start value is specified in milliseconds.
8582
* @param float|null $till End value is specified in milliseconds.
86-
*
8783
* @return $this
8884
*/
8985
public function toBeTotalTime(?float $from = null, ?float $till = null): static
@@ -103,7 +99,6 @@ public function toBeTotalTime(?float $from = null, ?float $till = null): static
10399
*
104100
* @param float|null $from Start value is specified in bytes.
105101
* @param float|null $till End value is specified in bytes.
106-
*
107102
* @return $this
108103
*/
109104
public function toBeMinMemory(?float $from = null, ?float $till = null): static
@@ -123,7 +118,6 @@ public function toBeMinMemory(?float $from = null, ?float $till = null): static
123118
*
124119
* @param float|null $from Start value is specified in bytes.
125120
* @param float|null $till End value is specified in bytes.
126-
*
127121
* @return $this
128122
*/
129123
public function toBeMaxMemory(?float $from = null, ?float $till = null): static
@@ -143,7 +137,6 @@ public function toBeMaxMemory(?float $from = null, ?float $till = null): static
143137
*
144138
* @param float|null $from Start value is specified in bytes.
145139
* @param float|null $till End value is specified in bytes.
146-
*
147140
* @return $this
148141
*/
149142
public function toBeAvgMemory(?float $from = null, ?float $till = null): static
@@ -163,7 +156,6 @@ public function toBeAvgMemory(?float $from = null, ?float $till = null): static
163156
*
164157
* @param float|null $from Start value is specified in bytes.
165158
* @param float|null $till End value is specified in bytes.
166-
*
167159
* @return $this
168160
*/
169161
public function toBeTotalMemory(?float $from = null, ?float $till = null): static
@@ -183,7 +175,6 @@ public function toBeTotalMemory(?float $from = null, ?float $till = null): stati
183175
*
184176
* @param float|null $from Start value is specified in percentages.
185177
* @param float|null $till End value is specified in percentages.
186-
*
187178
* @return $this
188179
*/
189180
public function toBeDeviationTime(?float $from = null, ?float $till = null): static
@@ -207,7 +198,6 @@ public function toBeDeviationTime(?float $from = null, ?float $till = null): sta
207198
*
208199
* @param float|null $from Start value is specified in percentages.
209200
* @param float|null $till End value is specified in percentages.
210-
*
211201
* @return $this
212202
*/
213203
public function toBeDeviationMemory(?float $from = null, ?float $till = null): static
@@ -275,8 +265,6 @@ protected function assertLessThan(float $actual, ?float $expected, string $name)
275265
*
276266
* @param float|null $from The start value of the range.
277267
* @param float|null $till The end value of the range.
278-
*
279-
* @return float|null
280268
*/
281269
protected function resolveFrom(?float $from, ?float $till): ?float
282270
{

src/Services/CallbacksService.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CallbacksService
2626
* Registers callback functions for comparison.
2727
*
2828
* @param array<int|string, Closure>|Closure ...$callbacks Callback functions or an array of callback functions
29-
* for comparison.
29+
* for comparison.
3030
*/
3131
public function compare(array|Closure ...$callbacks): void
3232
{
@@ -100,8 +100,6 @@ protected function perform(?Closure $callback, mixed ...$args): mixed
100100
* Extracts parameters from callback functions.
101101
*
102102
* @param array $callbacks An array of callback functions.
103-
*
104-
* @return array
105103
*/
106104
protected function parameters(array $callbacks): array
107105
{

src/Services/CollectorService.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class CollectorService
1313
*
1414
* @param int|string $name The callback name.
1515
* @param array $values An array of values [time in milliseconds, memory in bytes].
16-
*
1716
* @return $this
1817
*/
1918
public function push(int|string $name, array $values): static
@@ -25,8 +24,6 @@ public function push(int|string $name, array $values): static
2524

2625
/**
2726
* Returns all collected measurement data.
28-
*
29-
* @return array
3027
*/
3128
public function all(): array
3229
{

src/Services/DeviationService.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function __construct(
2323
* Calculates final results with deviations based on multiple runs.
2424
*
2525
* @param array<int, array<int|string, ResultData>> $collection A collection of results from multiple runs.
26-
*
2726
* @return array<int|string, ResultData>
2827
*/
2928
public function calculate(array $collection): array
@@ -37,7 +36,6 @@ public function calculate(array $collection): array
3736
* Transforms grouped data into an array of ResultData.
3837
*
3938
* @param array $collection Grouped measurement data.
40-
*
4139
* @return array<int|string, ResultData>
4240
*/
4341
protected function map(array $collection): array
@@ -49,8 +47,6 @@ protected function map(array $collection): array
4947
* Creates a ResultData object with metrics and deviations from grouped data.
5048
*
5149
* @param array $item Grouped data for a single callback.
52-
*
53-
* @return ResultData
5450
*/
5551
protected function make(array $item): ResultData
5652
{
@@ -68,8 +64,6 @@ protected function make(array $item): ResultData
6864
*
6965
* @param array $item Grouped data for a single callback.
7066
* @param string $key The metric key (min, max, avg, total).
71-
*
72-
* @return MetricData
7367
*/
7468
protected function metric(array $item, string $key): MetricData
7569
{
@@ -83,8 +77,6 @@ protected function metric(array $item, string $key): MetricData
8377
* Calculates deviation data based on average values.
8478
*
8579
* @param array $item Grouped data for a single callback.
86-
*
87-
* @return DeviationData
8880
*/
8981
protected function deviationMetric(array $item): DeviationData
9082
{
@@ -106,8 +98,6 @@ protected function deviationMetric(array $item): DeviationData
10698
*
10799
* @param float $time Time value is specified in milliseconds.
108100
* @param float $memory Memory value is specified in bytes.
109-
*
110-
* @return MetricData
111101
*/
112102
protected function metricData(float $time, float $memory): MetricData
113103
{
@@ -118,8 +108,6 @@ protected function metricData(float $time, float $memory): MetricData
118108
* Groups results from multiple runs by callback names and metric types.
119109
*
120110
* @param array $collection A collection of results from multiple runs.
121-
*
122-
* @return array
123111
*/
124112
protected function flatten(array $collection): array
125113
{
@@ -141,8 +129,6 @@ protected function flatten(array $collection): array
141129
* Calculates the standard deviation for an array of values.
142130
*
143131
* @param array $values An array of numeric values.
144-
*
145-
* @return float
146132
*/
147133
protected function deviation(array $values): float
148134
{
@@ -160,8 +146,7 @@ protected function deviation(array $values): float
160146
*
161147
* @param float $value1 The base value.
162148
* @param float $value2 The compared value.
163-
*
164-
* @return float The result is specified in percentages.
149+
* @return float The result is specified in percentages.
165150
*/
166151
protected function percentage(float $value1, float $value2): float
167152
{

src/Services/MeasurementErrorService.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ class MeasurementErrorService
1818
* Filters data by discarding extreme values to reduce measurement error.
1919
*
2020
* @param array $data An array of numeric measurement values.
21-
*
22-
* @return array The filtered array of values.
21+
* @return array The filtered array of values.
2322
*/
2423
public function filter(array $data): array
2524
{
@@ -37,8 +36,6 @@ public function filter(array $data): array
3736
*
3837
* @param array $data An array of numeric values.
3938
* @param int $count The number of elements in the array.
40-
*
41-
* @return array
4239
*/
4340
protected function partial(array $data, int $count): array
4441
{
@@ -54,8 +51,6 @@ protected function partial(array $data, int $count): array
5451
* Calculates the offset for discarding extreme values.
5552
*
5653
* @param int $count The number of elements in the array.
57-
*
58-
* @return int
5954
*/
6055
protected function offset(int $count): int
6156
{
@@ -66,8 +61,6 @@ protected function offset(int $count): int
6661
* Calculates the number of elements to keep after filtering.
6762
*
6863
* @param int $count The number of elements in the array.
69-
*
70-
* @return int
7164
*/
7265
protected function take(int $count): int
7366
{
@@ -78,8 +71,6 @@ protected function take(int $count): int
7871
* Checks whether filtering is disabled due to insufficient data.
7972
*
8073
* @param int $count The number of elements in the array.
81-
*
82-
* @return bool
8374
*/
8475
protected function disabled(int $count): bool
8576
{
@@ -90,8 +81,6 @@ protected function disabled(int $count): bool
9081
* Sorts the array of values in ascending order.
9182
*
9283
* @param array $values An array of numeric values.
93-
*
94-
* @return array
9584
*/
9685
protected function sort(array $values): array
9786
{

src/Services/MemoryService.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class MemoryService
2121
/**
2222
* Returns the current peak memory usage.
2323
*
24-
* @return int The value is specified in bytes.
24+
* @return int The value is specified in bytes.
2525
*/
2626
public function now(): int
2727
{
@@ -32,8 +32,7 @@ public function now(): int
3232
* Calculates the difference between the current peak memory usage and the provided value.
3333
*
3434
* @param int $memory The initial memory value is specified in bytes.
35-
*
36-
* @return int The difference is specified in bytes.
35+
* @return int The difference is specified in bytes.
3736
*/
3837
public function diff(int $memory): int
3938
{
@@ -53,8 +52,7 @@ public function reset(): void
5352
* Formats a memory value into a human-readable format.
5453
*
5554
* @param int $bytes The memory value is specified in bytes.
56-
*
57-
* @return string A formatted string (e.g., "1.50 MB").
55+
* @return string A formatted string (e.g., "1.50 MB").
5856
*/
5957
public function format(int $bytes): string
6058
{

0 commit comments

Comments
 (0)