From bb15d73cedb12861388acb3a4d11c165a883deae Mon Sep 17 00:00:00 2001 From: andrey-helldar <10347617+andrey-helldar@users.noreply.github.com> Date: Mon, 16 Feb 2026 14:26:51 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=8B=20The=20code=20style=20has=20been?= =?UTF-8?q?=20fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Benchmark.php | 19 +------------------ src/Services/AssertService.php | 12 ------------ src/Services/CallbacksService.php | 4 +--- src/Services/CollectorService.php | 3 --- src/Services/DeviationService.php | 17 +---------------- src/Services/MeasurementErrorService.php | 13 +------------ src/Services/MemoryService.php | 8 +++----- src/Services/ResultService.php | 20 -------------------- src/Services/RunnerService.php | 9 +++------ src/Services/ViewService.php | 2 -- src/Transformers/ResultTransformer.php | 18 ++++-------------- src/View/ProgressBarView.php | 1 - src/View/TableView.php | 8 -------- 13 files changed, 14 insertions(+), 120 deletions(-) diff --git a/src/Benchmark.php b/src/Benchmark.php index f1edeb5..08acbd6 100644 --- a/src/Benchmark.php +++ b/src/Benchmark.php @@ -38,8 +38,6 @@ public function __construct( /** * Creates a new benchmark instance. - * - * @return static */ public static function make(): static { @@ -50,7 +48,6 @@ public static function make(): static * Sets a callback to be executed before all iterations for each comparison. * * @param Closure(int|string $name): mixed $callback - * * @return $this */ public function before(Closure $callback): static @@ -64,7 +61,6 @@ public function before(Closure $callback): static * Sets a callback to be executed before each iteration. * * @param Closure(int|string $name, int<1, max> $iteration): mixed $callback - * * @return $this */ public function beforeEach(Closure $callback): static @@ -78,7 +74,6 @@ public function beforeEach(Closure $callback): static * Sets a callback to be executed after all iterations for each comparison. * * @param Closure(int|string $name): mixed $callback - * * @return $this */ public function after(Closure $callback): static @@ -92,7 +87,6 @@ public function after(Closure $callback): static * Sets a callback to be executed after each iteration. * * @param Closure(int|string $name, int<1, max> $iteration, float $time, float $memory): mixed $callback - * * @return $this */ public function afterEach(Closure $callback): static @@ -106,7 +100,6 @@ public function afterEach(Closure $callback): static * Sets the number of iterations for each comparison. * * @param int<1, max> $count - * * @return $this */ public function iterations(int $count): static @@ -120,7 +113,6 @@ public function iterations(int $count): static * Enables deviation calculation and sets the number of runs. * * @param int<2, max> $count - * * @return $this */ public function deviations(int $count = 2): static @@ -136,7 +128,6 @@ public function deviations(int $count = 2): static * Sets the rounding precision for time values. * * @param int<0, max>|null $precision The number of decimal places. Null means no rounding. - * * @return $this */ public function round(?int $precision): static @@ -162,7 +153,6 @@ public function disableProgressBar(): static * Registers callback functions for comparison. * * @param array|Closure ...$callbacks Callback functions or an array of callback functions for comparison. - * * @return $this */ public function compare(array|Closure ...$callbacks): static @@ -206,8 +196,6 @@ public function toConsole(): void /** * Returns the assertion service for performing result checks. - * - * @return AssertService */ public function toAssert(): AssertService { @@ -230,8 +218,6 @@ protected function perform(): void /** * Transforms collected data into an array of results. - * - * @return array */ protected function mapResult(): array { @@ -302,8 +288,6 @@ protected function withProgress(Closure $callback, int $total): void * * @param array $callbacks An array of callback functions. * @param int $multiplier The multiplier (number of runs). - * - * @return int */ protected function steps(array $callbacks, int $multiplier = 1): int { @@ -354,8 +338,7 @@ protected function run(mixed $name, Closure $callback, ProgressBarView $progress * * @param Closure $callback The callback function to execute. * @param array $parameters Parameters to pass to the callback. - * - * @return array An array [time in milliseconds, memory in bytes]. + * @return array An array [time in milliseconds, memory in bytes]. */ protected function call(Closure $callback, array $parameters = []): array { diff --git a/src/Services/AssertService.php b/src/Services/AssertService.php index ff59394..228e816 100644 --- a/src/Services/AssertService.php +++ b/src/Services/AssertService.php @@ -23,7 +23,6 @@ public function __construct( * * @param float|null $from Start value is specified in milliseconds. * @param float|null $till End value is specified in milliseconds. - * * @return $this */ public function toBeMinTime(?float $from = null, ?float $till = null): static @@ -43,7 +42,6 @@ public function toBeMinTime(?float $from = null, ?float $till = null): static * * @param float|null $from Start value is specified in milliseconds. * @param float|null $till End value is specified in milliseconds. - * * @return $this */ public function toBeMaxTime(?float $from = null, ?float $till = null): static @@ -63,7 +61,6 @@ public function toBeMaxTime(?float $from = null, ?float $till = null): static * * @param float|null $from Start value is specified in milliseconds. * @param float|null $till End value is specified in milliseconds. - * * @return $this */ public function toBeAvgTime(?float $from = null, ?float $till = null): static @@ -83,7 +80,6 @@ public function toBeAvgTime(?float $from = null, ?float $till = null): static * * @param float|null $from Start value is specified in milliseconds. * @param float|null $till End value is specified in milliseconds. - * * @return $this */ public function toBeTotalTime(?float $from = null, ?float $till = null): static @@ -103,7 +99,6 @@ public function toBeTotalTime(?float $from = null, ?float $till = null): static * * @param float|null $from Start value is specified in bytes. * @param float|null $till End value is specified in bytes. - * * @return $this */ public function toBeMinMemory(?float $from = null, ?float $till = null): static @@ -123,7 +118,6 @@ public function toBeMinMemory(?float $from = null, ?float $till = null): static * * @param float|null $from Start value is specified in bytes. * @param float|null $till End value is specified in bytes. - * * @return $this */ public function toBeMaxMemory(?float $from = null, ?float $till = null): static @@ -143,7 +137,6 @@ public function toBeMaxMemory(?float $from = null, ?float $till = null): static * * @param float|null $from Start value is specified in bytes. * @param float|null $till End value is specified in bytes. - * * @return $this */ public function toBeAvgMemory(?float $from = null, ?float $till = null): static @@ -163,7 +156,6 @@ public function toBeAvgMemory(?float $from = null, ?float $till = null): static * * @param float|null $from Start value is specified in bytes. * @param float|null $till End value is specified in bytes. - * * @return $this */ public function toBeTotalMemory(?float $from = null, ?float $till = null): static @@ -183,7 +175,6 @@ public function toBeTotalMemory(?float $from = null, ?float $till = null): stati * * @param float|null $from Start value is specified in percentages. * @param float|null $till End value is specified in percentages. - * * @return $this */ public function toBeDeviationTime(?float $from = null, ?float $till = null): static @@ -207,7 +198,6 @@ public function toBeDeviationTime(?float $from = null, ?float $till = null): sta * * @param float|null $from Start value is specified in percentages. * @param float|null $till End value is specified in percentages. - * * @return $this */ public function toBeDeviationMemory(?float $from = null, ?float $till = null): static @@ -275,8 +265,6 @@ protected function assertLessThan(float $actual, ?float $expected, string $name) * * @param float|null $from The start value of the range. * @param float|null $till The end value of the range. - * - * @return float|null */ protected function resolveFrom(?float $from, ?float $till): ?float { diff --git a/src/Services/CallbacksService.php b/src/Services/CallbacksService.php index 8fc91bd..6be860d 100644 --- a/src/Services/CallbacksService.php +++ b/src/Services/CallbacksService.php @@ -26,7 +26,7 @@ class CallbacksService * Registers callback functions for comparison. * * @param array|Closure ...$callbacks Callback functions or an array of callback functions - * for comparison. + * for comparison. */ public function compare(array|Closure ...$callbacks): void { @@ -100,8 +100,6 @@ protected function perform(?Closure $callback, mixed ...$args): mixed * Extracts parameters from callback functions. * * @param array $callbacks An array of callback functions. - * - * @return array */ protected function parameters(array $callbacks): array { diff --git a/src/Services/CollectorService.php b/src/Services/CollectorService.php index 1f9cd83..3283fc0 100644 --- a/src/Services/CollectorService.php +++ b/src/Services/CollectorService.php @@ -13,7 +13,6 @@ class CollectorService * * @param int|string $name The callback name. * @param array $values An array of values [time in milliseconds, memory in bytes]. - * * @return $this */ public function push(int|string $name, array $values): static @@ -25,8 +24,6 @@ public function push(int|string $name, array $values): static /** * Returns all collected measurement data. - * - * @return array */ public function all(): array { diff --git a/src/Services/DeviationService.php b/src/Services/DeviationService.php index 3b71efa..2846f5d 100644 --- a/src/Services/DeviationService.php +++ b/src/Services/DeviationService.php @@ -23,7 +23,6 @@ public function __construct( * Calculates final results with deviations based on multiple runs. * * @param array> $collection A collection of results from multiple runs. - * * @return array */ public function calculate(array $collection): array @@ -37,7 +36,6 @@ public function calculate(array $collection): array * Transforms grouped data into an array of ResultData. * * @param array $collection Grouped measurement data. - * * @return array */ protected function map(array $collection): array @@ -49,8 +47,6 @@ protected function map(array $collection): array * Creates a ResultData object with metrics and deviations from grouped data. * * @param array $item Grouped data for a single callback. - * - * @return ResultData */ protected function make(array $item): ResultData { @@ -68,8 +64,6 @@ protected function make(array $item): ResultData * * @param array $item Grouped data for a single callback. * @param string $key The metric key (min, max, avg, total). - * - * @return MetricData */ protected function metric(array $item, string $key): MetricData { @@ -83,8 +77,6 @@ protected function metric(array $item, string $key): MetricData * Calculates deviation data based on average values. * * @param array $item Grouped data for a single callback. - * - * @return DeviationData */ protected function deviationMetric(array $item): DeviationData { @@ -106,8 +98,6 @@ protected function deviationMetric(array $item): DeviationData * * @param float $time Time value is specified in milliseconds. * @param float $memory Memory value is specified in bytes. - * - * @return MetricData */ protected function metricData(float $time, float $memory): MetricData { @@ -118,8 +108,6 @@ protected function metricData(float $time, float $memory): MetricData * Groups results from multiple runs by callback names and metric types. * * @param array $collection A collection of results from multiple runs. - * - * @return array */ protected function flatten(array $collection): array { @@ -141,8 +129,6 @@ protected function flatten(array $collection): array * Calculates the standard deviation for an array of values. * * @param array $values An array of numeric values. - * - * @return float */ protected function deviation(array $values): float { @@ -160,8 +146,7 @@ protected function deviation(array $values): float * * @param float $value1 The base value. * @param float $value2 The compared value. - * - * @return float The result is specified in percentages. + * @return float The result is specified in percentages. */ protected function percentage(float $value1, float $value2): float { diff --git a/src/Services/MeasurementErrorService.php b/src/Services/MeasurementErrorService.php index 1753bda..1e94706 100644 --- a/src/Services/MeasurementErrorService.php +++ b/src/Services/MeasurementErrorService.php @@ -18,8 +18,7 @@ class MeasurementErrorService * Filters data by discarding extreme values to reduce measurement error. * * @param array $data An array of numeric measurement values. - * - * @return array The filtered array of values. + * @return array The filtered array of values. */ public function filter(array $data): array { @@ -37,8 +36,6 @@ public function filter(array $data): array * * @param array $data An array of numeric values. * @param int $count The number of elements in the array. - * - * @return array */ protected function partial(array $data, int $count): array { @@ -54,8 +51,6 @@ protected function partial(array $data, int $count): array * Calculates the offset for discarding extreme values. * * @param int $count The number of elements in the array. - * - * @return int */ protected function offset(int $count): int { @@ -66,8 +61,6 @@ protected function offset(int $count): int * Calculates the number of elements to keep after filtering. * * @param int $count The number of elements in the array. - * - * @return int */ protected function take(int $count): int { @@ -78,8 +71,6 @@ protected function take(int $count): int * Checks whether filtering is disabled due to insufficient data. * * @param int $count The number of elements in the array. - * - * @return bool */ protected function disabled(int $count): bool { @@ -90,8 +81,6 @@ protected function disabled(int $count): bool * Sorts the array of values in ascending order. * * @param array $values An array of numeric values. - * - * @return array */ protected function sort(array $values): array { diff --git a/src/Services/MemoryService.php b/src/Services/MemoryService.php index 99d3ca2..40d33f5 100644 --- a/src/Services/MemoryService.php +++ b/src/Services/MemoryService.php @@ -21,7 +21,7 @@ class MemoryService /** * Returns the current peak memory usage. * - * @return int The value is specified in bytes. + * @return int The value is specified in bytes. */ public function now(): int { @@ -32,8 +32,7 @@ public function now(): int * Calculates the difference between the current peak memory usage and the provided value. * * @param int $memory The initial memory value is specified in bytes. - * - * @return int The difference is specified in bytes. + * @return int The difference is specified in bytes. */ public function diff(int $memory): int { @@ -53,8 +52,7 @@ public function reset(): void * Formats a memory value into a human-readable format. * * @param int $bytes The memory value is specified in bytes. - * - * @return string A formatted string (e.g., "1.50 MB"). + * @return string A formatted string (e.g., "1.50 MB"). */ public function format(int $bytes): string { diff --git a/src/Services/ResultService.php b/src/Services/ResultService.php index 852f36f..0677af2 100644 --- a/src/Services/ResultService.php +++ b/src/Services/ResultService.php @@ -24,8 +24,6 @@ public function __construct( /** * Checks whether results have already been calculated. - * - * @return bool */ public function has(): bool { @@ -46,7 +44,6 @@ public function force(array $collection): void * Returns benchmark results, calculating them on the first call. * * @param array $collections Collected measurement data. - * * @return ResultData[] */ public function get(array $collections): array @@ -66,7 +63,6 @@ public function clear(): void * Transforms collected measurement data into an array of ResultData. * * @param array $collections Collected measurement data. - * * @return ResultData[] */ public function map(array $collections): array @@ -85,8 +81,6 @@ public function map(array $collections): array * @param array $data An array of measurement data. * @param int $column The column index (0 — time, 1 — memory). * @param bool $filter Whether to apply measurement error filtering. - * - * @return array */ public function values(array $data, int $column, bool $filter = true): array { @@ -100,8 +94,6 @@ public function values(array $data, int $column, bool $filter = true): array * * @param array $times An array of time values in milliseconds. * @param array $memory An array of memory values in bytes. - * - * @return ResultData */ protected function collect(array $times, array $memory): ResultData { @@ -118,8 +110,6 @@ protected function collect(array $times, array $memory): ResultData * * @param array $times An array of time values in milliseconds. * @param array $memory An array of memory values in bytes. - * - * @return MetricData */ public function min(array $times, array $memory): MetricData { @@ -134,8 +124,6 @@ public function min(array $times, array $memory): MetricData * * @param array $times An array of time values in milliseconds. * @param array $memory An array of memory values in bytes. - * - * @return MetricData */ public function max(array $times, array $memory): MetricData { @@ -150,8 +138,6 @@ public function max(array $times, array $memory): MetricData * * @param array $times An array of time values in milliseconds. * @param array $memory An array of memory values in bytes. - * - * @return MetricData */ public function avg(array $times, array $memory): MetricData { @@ -166,8 +152,6 @@ public function avg(array $times, array $memory): MetricData * * @param array $times An array of time values in milliseconds. * @param array $memory An array of memory values in bytes. - * - * @return MetricData */ public function total(array $times, array $memory): MetricData { @@ -182,8 +166,6 @@ public function total(array $times, array $memory): MetricData * * @param float $time Time value is specified in milliseconds. * @param float $memory Memory value is specified in bytes. - * - * @return MetricData */ protected function metric(float $time, float $memory): MetricData { @@ -194,8 +176,6 @@ protected function metric(float $time, float $memory): MetricData * Filters values to reduce measurement error. * * @param array $values An array of numeric values. - * - * @return array */ protected function filter(array $values): array { diff --git a/src/Services/RunnerService.php b/src/Services/RunnerService.php index 8b4e1c4..f214425 100644 --- a/src/Services/RunnerService.php +++ b/src/Services/RunnerService.php @@ -19,8 +19,7 @@ public function __construct( * * @param Closure $callback The callback function to execute. * @param array $parameters Parameters to pass to the callback. - * - * @return array An array [time in milliseconds, memory in bytes]. + * @return array An array [time in milliseconds, memory in bytes]. */ public function call(Closure $callback, array $parameters = []): array { @@ -42,8 +41,7 @@ protected function clean(): void * * @param Closure $callback The callback function to execute. * @param array $parameters Parameters to pass to the callback. - * - * @return array An array [time in milliseconds, memory in bytes]. + * @return array An array [time in milliseconds, memory in bytes]. */ protected function run(Closure $callback, array $parameters = []): array { @@ -63,8 +61,7 @@ protected function run(Closure $callback, array $parameters = []): array * * @param float $now The current hrtime value is specified in nanoseconds. * @param float $startAt The initial hrtime value is specified in nanoseconds. - * - * @return float The difference is specified in milliseconds. + * @return float The difference is specified in milliseconds. */ protected function diff(float $now, float $startAt): float { diff --git a/src/Services/ViewService.php b/src/Services/ViewService.php index 08cf689..c0ac3eb 100644 --- a/src/Services/ViewService.php +++ b/src/Services/ViewService.php @@ -28,8 +28,6 @@ public function table(array $data): void /** * Returns the progress bar instance. - * - * @return ProgressBarView */ public function progressBar(): ProgressBarView { diff --git a/src/Transformers/ResultTransformer.php b/src/Transformers/ResultTransformer.php index 545e32d..11d8134 100644 --- a/src/Transformers/ResultTransformer.php +++ b/src/Transformers/ResultTransformer.php @@ -41,8 +41,6 @@ public function round(?int $precision): void * Transforms a result collection into a table format for display. * * @param \DragonCode\Benchmark\Data\ResultData[] $collection - * - * @return array */ public function toTable(array $collection): array { @@ -56,8 +54,6 @@ public function toTable(array $collection): array * * @param array $table The table template. * @param \DragonCode\Benchmark\Data\ResultData[] $collection - * - * @return array */ protected function map(array $table, array $collection): array { @@ -89,8 +85,6 @@ protected function map(array $table, array $collection): array * * @param array $table The table with data. * @param \DragonCode\Benchmark\Data\ResultData[] $collection - * - * @return array */ protected function order(array $table, array $collection): array { @@ -113,8 +107,7 @@ protected function order(array $table, array $collection): array * Formats a metric into a string with time and memory. * * @param MetricData $metric The metric. Time is specified in milliseconds, memory in bytes. - * - * @return string A formatted string (e.g., "0.123 ms - 2.00 MB"). + * @return string A formatted string (e.g., "0.123 ms - 2.00 MB"). */ protected function value(MetricData $metric): string { @@ -130,8 +123,7 @@ protected function value(MetricData $metric): string * Formats a deviation value into a string with percentages. * * @param float $value The deviation value is specified in percentages. - * - * @return string A formatted string (e.g., "+1.23%"). + * @return string A formatted string (e.g., "+1.23%"). */ protected function deviation(float $value): string { @@ -144,8 +136,7 @@ protected function deviation(float $value): string * Rounds a time value with the specified precision. * * @param float $value Time value is specified in milliseconds. - * - * @return float The rounded value is specified in milliseconds. + * @return float The rounded value is specified in milliseconds. */ protected function time(float $value): float { @@ -160,8 +151,7 @@ protected function time(float $value): float * Formats a memory value into a human-readable format. * * @param float|int $bytes The memory value is specified in bytes. - * - * @return string A formatted string (e.g., "2.00 MB"). + * @return string A formatted string (e.g., "2.00 MB"). */ protected function memory(float|int $bytes): string { diff --git a/src/View/ProgressBarView.php b/src/View/ProgressBarView.php index 4676869..b6d0423 100644 --- a/src/View/ProgressBarView.php +++ b/src/View/ProgressBarView.php @@ -34,7 +34,6 @@ public function disable(): static * Creates a progress bar with the specified total number of steps. * * @param int $total The total number of steps. - * * @return $this */ public function create(int $total): static diff --git a/src/View/TableView.php b/src/View/TableView.php index fbc3380..a3a5574 100644 --- a/src/View/TableView.php +++ b/src/View/TableView.php @@ -45,8 +45,6 @@ public function show(array $data): void * Extracts column headers from the data. * * @param array $data An array of table rows. - * - * @return array */ protected function headers(array $data): array { @@ -58,8 +56,6 @@ protected function headers(array $data): array * * @param array $headers The column headers. * @param array $data An array of table rows. - * - * @return array */ protected function columnWidths(array $headers, array $data): array { @@ -78,8 +74,6 @@ protected function columnWidths(array $headers, array $data): array * Creates a table separator line. * * @param array $widths An array of column widths. - * - * @return string */ protected function separator(array $widths): string { @@ -93,8 +87,6 @@ protected function separator(array $widths): string * * @param array $values The cell values of the row. * @param array $widths An array of column widths. - * - * @return string */ protected function formatRow(array $values, array $widths): string {