From c1ba474585ef057702a5f839215c259d50d86849 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 19 Nov 2024 23:46:58 +0700 Subject: [PATCH] fix print return --- .../Fixture/arrow_function_inside_call_like.php.inc | 4 ++-- .../Fixture/preserve-by-ref-closureuse.php.inc | 2 +- .../Fixture/with_nullable_return_type.php.inc | 2 +- .../Fixture/with_return_type.php.inc | 2 +- .../Fixture/in_arrow_function.php.inc | 2 +- .../Fixture/in_arrow_function2.php.inc | 2 +- .../Fixture/in_arrow_function_as_invokable.php.inc | 2 +- .../Fixture/in_arrow_function_in_expression.php.inc | 2 +- .../Fixture/in_arrow_function_in_return.php.inc | 2 +- .../DowngradeArrayIsListRector/Fixture/fixture.php.inc | 2 +- .../DowngradeArrayIsListRector/Fixture/inside_if.php.inc | 2 +- .../DowngradeArrayIsListRector/Fixture/inside_return.php.inc | 2 +- .../Fixture/no_scope_parent_assign_from_func_call.php.inc | 2 +- .../DowngradeArrayIsListArrowFunction/Fixture/fixture.php.inc | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/arrow_function_inside_call_like.php.inc b/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/arrow_function_inside_call_like.php.inc index 2cf3f7e6..99f01cbd 100644 --- a/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/arrow_function_inside_call_like.php.inc +++ b/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/arrow_function_inside_call_like.php.inc @@ -33,8 +33,8 @@ class ErrorsConsoleStyle public function table(int $terminalWidth, int $maxHeaderWidth): void { - $f = static function ($rows) use ($terminalWidth, $maxHeaderWidth) : array { - return array_map(static function ($row) use ($terminalWidth, $maxHeaderWidth) : array { + $f = static function ($rows) use ($terminalWidth, $maxHeaderWidth): array { + return array_map(static function ($row) use ($terminalWidth, $maxHeaderWidth): array { return array_map(static function ($s) use ($terminalWidth, $maxHeaderWidth) { if ($terminalWidth > $maxHeaderWidth + 5) { return wordwrap( diff --git a/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/preserve-by-ref-closureuse.php.inc b/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/preserve-by-ref-closureuse.php.inc index cfe9515d..b366b010 100644 --- a/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/preserve-by-ref-closureuse.php.inc +++ b/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/preserve-by-ref-closureuse.php.inc @@ -37,7 +37,7 @@ class PreserveByRefClosureUse $nameScopeMap = []; $f = function () use ($j, &$nameScopeMap): ?int { $nameScopeMap[] = function () use ($j): callable { - return static function (int $i) use ($j) : int { + return static function (int $i) use ($j): int { return $i + $j; }; }; diff --git a/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/with_nullable_return_type.php.inc b/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/with_nullable_return_type.php.inc index 9ba1bcc4..0901d89f 100644 --- a/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/with_nullable_return_type.php.inc +++ b/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/with_nullable_return_type.php.inc @@ -20,7 +20,7 @@ class WithNullableReturnType { public function run() { - $callable = function () : ?string { + $callable = function (): ?string { return 'Hello world'; }; } diff --git a/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/with_return_type.php.inc b/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/with_return_type.php.inc index 3c45e3e3..c25f6210 100644 --- a/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/with_return_type.php.inc +++ b/rules-tests/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/with_return_type.php.inc @@ -20,7 +20,7 @@ class WithReturnType { public function run() { - $callable = function () : string { + $callable = function (): string { return 'Hello world'; }; } diff --git a/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function.php.inc b/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function.php.inc index 8decb635..8656ee22 100644 --- a/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function.php.inc +++ b/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function.php.inc @@ -36,7 +36,7 @@ final class InArrowFunction ]; $mapped = array_map( - static function (mixed $default) : mixed { + static function (mixed $default): mixed { switch (true) { case is_string($default): return sprintf('"%s"', $default); diff --git a/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function2.php.inc b/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function2.php.inc index 8e76b294..a4286efe 100644 --- a/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function2.php.inc +++ b/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function2.php.inc @@ -23,7 +23,7 @@ final class InArrowFunction2 { public function run($value) { - $mapped = static function (mixed $default) : mixed { + $mapped = static function (mixed $default): mixed { switch (true) { case is_string($default): return sprintf('"%s"', $default); diff --git a/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function_as_invokable.php.inc b/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function_as_invokable.php.inc index 843a4208..3cb037d1 100644 --- a/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function_as_invokable.php.inc +++ b/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function_as_invokable.php.inc @@ -21,7 +21,7 @@ final class InArrowFunctionAsInvokable { public function run($value) { - (static function (mixed $default) : mixed { + (static function (mixed $default): mixed { switch (true) { case is_string($default): return sprintf('"%s"', $default); diff --git a/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function_in_expression.php.inc b/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function_in_expression.php.inc index 7d91a02b..928b3cff 100644 --- a/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function_in_expression.php.inc +++ b/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function_in_expression.php.inc @@ -21,7 +21,7 @@ final class InArrowFunctionInExpression { public function run($value) { - static function (mixed $default) : mixed { + static function (mixed $default): mixed { switch (true) { case is_string($default): return sprintf('"%s"', $default); diff --git a/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function_in_return.php.inc b/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function_in_return.php.inc index 1ae2b458..c4d48021 100644 --- a/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function_in_return.php.inc +++ b/rules-tests/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/in_arrow_function_in_return.php.inc @@ -21,7 +21,7 @@ final class InArrowFunctionInReturn { public function run($value) { - return static function (mixed $default) : mixed { + return static function (mixed $default): mixed { switch (true) { case is_string($default): return sprintf('"%s"', $default); diff --git a/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/fixture.php.inc b/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/fixture.php.inc index ee2c3882..9569f145 100644 --- a/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/fixture.php.inc +++ b/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/fixture.php.inc @@ -10,7 +10,7 @@ array_is_list([1 => 'apple', 'orange']); namespace Rector\Tests\DowngradePhp81\Rector\FuncCall\DowngradeArrayIsListRector\Fixture; -$arrayIsListFunction = function (array $array) : bool { +$arrayIsListFunction = function (array $array): bool { if (function_exists('array_is_list')) { return array_is_list($array); } diff --git a/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/inside_if.php.inc b/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/inside_if.php.inc index 208f9330..2ae00f23 100644 --- a/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/inside_if.php.inc +++ b/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/inside_if.php.inc @@ -16,7 +16,7 @@ namespace Rector\Tests\DowngradePhp81\Rector\FuncCall\DowngradeArrayIsListRector function insideIf($arguments) { - $arrayIsListFunction = function (array $array) : bool { + $arrayIsListFunction = function (array $array): bool { if (function_exists('array_is_list')) { return array_is_list($array); } diff --git a/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/inside_return.php.inc b/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/inside_return.php.inc index e857dfe2..ad1ec154 100644 --- a/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/inside_return.php.inc +++ b/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/inside_return.php.inc @@ -15,7 +15,7 @@ namespace Rector\Tests\DowngradePhp81\Rector\FuncCall\DowngradeArrayIsListRector function insideReturn($arguments) { - $arrayIsListFunction = function (array $array) : bool { + $arrayIsListFunction = function (array $array): bool { if (function_exists('array_is_list')) { return array_is_list($array); } diff --git a/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/no_scope_parent_assign_from_func_call.php.inc b/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/no_scope_parent_assign_from_func_call.php.inc index 22f3331b..0c8b2657 100644 --- a/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/no_scope_parent_assign_from_func_call.php.inc +++ b/rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector/Fixture/no_scope_parent_assign_from_func_call.php.inc @@ -41,7 +41,7 @@ final class Loop } register_shutdown_function(function () { - $arrayIsListFunction = function (array $array) : bool { + $arrayIsListFunction = function (array $array): bool { if (function_exists('array_is_list')) { return array_is_list($array); } diff --git a/tests/Issues/DowngradeArrayIsListArrowFunction/Fixture/fixture.php.inc b/tests/Issues/DowngradeArrayIsListArrowFunction/Fixture/fixture.php.inc index c62bef6d..2488d92a 100644 --- a/tests/Issues/DowngradeArrayIsListArrowFunction/Fixture/fixture.php.inc +++ b/tests/Issues/DowngradeArrayIsListArrowFunction/Fixture/fixture.php.inc @@ -23,7 +23,7 @@ class Fixture { public function run($items) { - $arrayIsListFunction = function (array $array) : bool { + $arrayIsListFunction = function (array $array): bool { if (function_exists('array_is_list')) { return array_is_list($array); }