From 8b8aa43f4bcb8a6310d3d524b9cbe128e1b2bef2 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 19 Jul 2022 19:56:21 +0200 Subject: [PATCH] move type declaration rules to enterprise version --- .../Fixture/arrow_function_.php.inc | 35 --- .../Fixture/assigned_to_variable.php.inc | 39 --- .../Fixture/function_.php.inc | 29 -- .../Fixture/inner_closure.php.inc | 31 --- .../Fixture/return_self.php.inc | 25 -- .../Fixture/return_static.php.inc | 25 -- .../Fixture/skip_already_set.php.inc | 16 -- .../skip_double_assigned_to_variable.php.inc | 19 -- ...d_between_assign_and_return_by_ref.php.inc | 26 -- ..._between_assign_and_return_with_if.php.inc | 21 -- .../Fixture/some_class.php.inc | 35 --- ...changed_after_assigned_to_variable.php.inc | 41 --- .../FixturePhp74/return_static.php.inc | 27 -- .../Php74Test.php | 33 --- .../ReturnTypeFromReturnNewRectorTest.php | 33 --- .../Source/SomeResponse.php | 13 - .../Source/SomeResponseInterface.php | 10 - .../config/configured_rule.php | 13 - .../config/php74.php | 13 - .../Fixture/multi_returns_all_bool.php.inc | 35 --- .../skip_multi_returns_no_root.php.inc | 17 -- .../Fixture/skip_nested_return.php.inc | 13 - ...kip_root_return_with_nested_return.php.inc | 15 -- .../Fixture/skip_void_return.php.inc | 11 - .../Fixture/some_class.php.inc | 37 --- .../Fixture/some_closure.php.inc | 31 --- .../void_return_in_inner_function.php.inc | 45 ---- .../yield_parent_inner_function.php.inc | 45 ---- ...TypeFromStrictBoolReturnExprRectorTest.php | 33 --- .../config/configured_rule.php | 10 - .../Fixture/skip_custom_function.php.inc | 16 -- .../Fixture/some_class.php.inc | 27 -- .../Fixture/some_native_method_call.php.inc | 27 -- ...turnTypeFromStrictNativeCallRectorTest.php | 33 --- .../config/configured_rule.php | 11 - ...ot_change_more_detailed_return_doc.php.inc | 67 ----- ...t_change_more_detailed_return_doc2.php.inc | 45 ---- .../include_simple_array_shape.php.inc | 46 ---- .../make_complex_array_shape_simpler.php.inc | 50 ---- ...nested_complex_array_shape_simpler.php.inc | 56 ---- .../return_override_with_array.php.inc | 38 --- .../Fixture/return_specific_type.php.inc | 44 ---- ...ied_type_between_assign_and_return.php.inc | 20 -- .../Fixture/skip_override.php.inc | 15 -- .../Fixture/skip_two_returns.php.inc | 17 -- .../Fixture/some_class.php.inc | 31 --- ...ReturnTypeFromStrictNewArrayRectorTest.php | 33 --- .../Source/AppleJuice.php | 9 - .../Source/Resource.php | 15 -- .../config/configured_rule.php | 10 - .../Fixture/also_static_call.php.inc | 43 --- .../Fixture/arrow_function.php.inc | 39 --- ...inner_functionlike_only_has_return.php.inc | 65 ----- .../Fixture/external_caller.php.inc | 31 --- .../Fixture/external_static_caller.php.inc | 31 --- ...functionlike_and_parent_has_return.php.inc | 69 ----- .../Fixture/return_function.php.inc | 37 --- .../return_self_different_namespace.php.inc | 37 --- ..._self_different_namespace_nullable.php.inc | 37 --- .../Fixture/skip_arrow_function_void.php.inc | 13 - .../Fixture/skip_constructor_for_void.php.inc | 11 - .../skip_external_function_caller.php.inc | 13 - .../Fixture/skip_false_report_type.php.inc | 19 -- .../Fixture/skip_interface_for_void.php.inc | 8 - .../skip_once_type_and_once_not.php.inc | 29 -- .../Fixture/skip_possible_no_return.php.inc | 18 -- .../Fixture/skip_twice_different_type.php.inc | 25 -- .../Fixture/some_class.php.inc | 37 --- .../Fixture/twice_same_type.php.inc | 45 ---- .../Fixture/use_return_self.php.inc | 47 ---- .../Fixture/use_return_self_nullable.php.inc | 55 ---- .../mix_of_nullable_types.php.inc | 55 ---- .../FixturePhp80/mix_of_union_types.php.inc | 55 ---- .../FixturePhp80/twice_different_type.php.inc | 55 ---- .../Php80Test.php | 33 --- ...eturnTypeFromStrictTypedCallRectorTest.php | 33 --- .../Source/CallWithVoid.php | 12 - .../Source/ReturnSelfFromSource.php | 13 - .../Source/ReturnSelfFromSourceNullable.php | 17 -- .../Source/SomeExternalCaller.php | 13 - .../Source/SomeExternalStaticCaller.php | 13 - .../Source/external_bool_function.php | 10 - .../config/configured_rule.php | 13 - .../config/php80_rule.php | 13 - .../Fixture/inner_classmethod.php.inc | 39 --- .../Fixture/skip_doc_type.php.inc | 16 -- .../Fixture/skip_one_missing_type.php.inc | 22 -- .../Fixture/skip_single_void.php.inc | 17 -- .../Fixture/some_class.php.inc | 31 --- .../Fixture/some_union_type.php.inc | 31 --- .../Fixture/two_returns_union_type.php.inc | 43 --- ...nTypeFromStrictTypedPropertyRectorTest.php | 33 --- .../config/configured_rule.php | 10 - .../ReturnTypeFromReturnNewRector.php | 185 ------------- ...turnTypeFromStrictBoolReturnExprRector.php | 86 ------ .../ReturnTypeFromStrictNativeCallRector.php | 105 -------- .../ReturnTypeFromStrictNewArrayRector.php | 247 ------------------ .../ReturnTypeFromStrictTypedCallRector.php | 241 ----------------- ...eturnTypeFromStrictTypedPropertyRector.php | 145 ---------- rules/TypeDeclaration/TypeNormalizer.php | 3 + 100 files changed, 3 insertions(+), 3681 deletions(-) delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/arrow_function_.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/assigned_to_variable.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/function_.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/inner_closure.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/return_self.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/return_static.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/skip_already_set.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/skip_double_assigned_to_variable.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/skip_type_modified_between_assign_and_return_by_ref.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/skip_type_modified_between_assign_and_return_with_if.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/some_class.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/type_not_changed_after_assigned_to_variable.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/FixturePhp74/return_static.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Php74Test.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/ReturnTypeFromReturnNewRectorTest.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Source/SomeResponse.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Source/SomeResponseInterface.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/config/configured_rule.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/config/php74.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/multi_returns_all_bool.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/skip_multi_returns_no_root.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/skip_nested_return.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/skip_root_return_with_nested_return.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/skip_void_return.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/some_class.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/some_closure.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/void_return_in_inner_function.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/yield_parent_inner_function.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/ReturnTypeFromStrictBoolReturnExprRectorTest.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/config/configured_rule.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/Fixture/skip_custom_function.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/Fixture/some_class.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/Fixture/some_native_method_call.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/ReturnTypeFromStrictNativeCallRectorTest.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/config/configured_rule.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/do_not_change_more_detailed_return_doc.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/do_not_change_more_detailed_return_doc2.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/include_simple_array_shape.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/make_complex_array_shape_simpler.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/make_nested_complex_array_shape_simpler.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/return_override_with_array.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/return_specific_type.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/skip_modified_type_between_assign_and_return.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/skip_override.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/skip_two_returns.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/some_class.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/ReturnTypeFromStrictNewArrayRectorTest.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Source/AppleJuice.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Source/Resource.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/config/configured_rule.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/also_static_call.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/arrow_function.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/do_not_return_parent_inner_functionlike_only_has_return.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/external_caller.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/external_static_caller.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/inner_functionlike_and_parent_has_return.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_function.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_self_different_namespace.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_self_different_namespace_nullable.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_arrow_function_void.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_constructor_for_void.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_external_function_caller.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_false_report_type.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_interface_for_void.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_once_type_and_once_not.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_possible_no_return.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_twice_different_type.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/some_class.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/twice_same_type.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/use_return_self.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/use_return_self_nullable.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/mix_of_nullable_types.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/mix_of_union_types.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/twice_different_type.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Php80Test.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/ReturnTypeFromStrictTypedCallRectorTest.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Source/CallWithVoid.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Source/ReturnSelfFromSource.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Source/ReturnSelfFromSourceNullable.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Source/SomeExternalCaller.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Source/SomeExternalStaticCaller.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Source/external_bool_function.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/config/configured_rule.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/config/php80_rule.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/inner_classmethod.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/skip_doc_type.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/skip_one_missing_type.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/skip_single_void.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/some_class.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/some_union_type.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/two_returns_union_type.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/ReturnTypeFromStrictTypedPropertyRectorTest.php delete mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/config/configured_rule.php delete mode 100644 rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php delete mode 100644 rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector.php delete mode 100644 rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector.php delete mode 100644 rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php delete mode 100644 rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php delete mode 100644 rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/arrow_function_.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/arrow_function_.php.inc deleted file mode 100644 index 1419d2eec67..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/arrow_function_.php.inc +++ /dev/null @@ -1,35 +0,0 @@ - new SomeResponse(); - } -} - -?> ------ - new SomeResponse(); - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/assigned_to_variable.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/assigned_to_variable.php.inc deleted file mode 100644 index a35f3714a25..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/assigned_to_variable.php.inc +++ /dev/null @@ -1,39 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/function_.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/function_.php.inc deleted file mode 100644 index 700a2f669e0..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/function_.php.inc +++ /dev/null @@ -1,29 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/inner_closure.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/inner_closure.php.inc deleted file mode 100644 index fdc116b5edc..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/inner_closure.php.inc +++ /dev/null @@ -1,31 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/return_self.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/return_self.php.inc deleted file mode 100644 index 7e65cb190cd..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/return_self.php.inc +++ /dev/null @@ -1,25 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/return_static.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/return_static.php.inc deleted file mode 100644 index 8a939e35b2d..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/return_static.php.inc +++ /dev/null @@ -1,25 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/skip_already_set.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/skip_already_set.php.inc deleted file mode 100644 index caf8cb1cc73..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/skip_already_set.php.inc +++ /dev/null @@ -1,16 +0,0 @@ -verify($response); - - return $response; - } - - private function verify(SomeResponse &$someResponse): void - { - if (is_cli()) { - $someResponse = new CLIResponse(); - } - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/skip_type_modified_between_assign_and_return_with_if.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/skip_type_modified_between_assign_and_return_with_if.php.inc deleted file mode 100644 index dc15fdedc07..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/skip_type_modified_between_assign_and_return_with_if.php.inc +++ /dev/null @@ -1,21 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/type_not_changed_after_assigned_to_variable.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/type_not_changed_after_assigned_to_variable.php.inc deleted file mode 100644 index 3fd3910033d..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Fixture/type_not_changed_after_assigned_to_variable.php.inc +++ /dev/null @@ -1,41 +0,0 @@ -setBody('some message'); - - return $response; - } -} - -?> ------ -setBody('some message'); - - return $response; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/FixturePhp74/return_static.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/FixturePhp74/return_static.php.inc deleted file mode 100644 index d60d9751148..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/FixturePhp74/return_static.php.inc +++ /dev/null @@ -1,27 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Php74Test.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Php74Test.php deleted file mode 100644 index ea3ead539b0..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Php74Test.php +++ /dev/null @@ -1,33 +0,0 @@ -doTestFileInfo($fileInfo); - } - - /** - * @return Iterator - */ - public function provideData(): Iterator - { - return $this->yieldFilesFromDirectory(__DIR__ . '/FixturePhp74'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/php74.php'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/ReturnTypeFromReturnNewRectorTest.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/ReturnTypeFromReturnNewRectorTest.php deleted file mode 100644 index 62cbd5e85ba..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/ReturnTypeFromReturnNewRectorTest.php +++ /dev/null @@ -1,33 +0,0 @@ -doTestFileInfo($fileInfo); - } - - /** - * @return Iterator - */ - public function provideData(): Iterator - { - return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Source/SomeResponse.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Source/SomeResponse.php deleted file mode 100644 index 4d2be3f1908..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Source/SomeResponse.php +++ /dev/null @@ -1,13 +0,0 @@ -body = $body; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Source/SomeResponseInterface.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Source/SomeResponseInterface.php deleted file mode 100644 index 8ca192f8dee..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/Source/SomeResponseInterface.php +++ /dev/null @@ -1,10 +0,0 @@ -rule(ReturnTypeFromReturnNewRector::class); - - $rectorConfig->phpVersion(PhpVersionFeature::STATIC_RETURN_TYPE); -}; diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/config/php74.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/config/php74.php deleted file mode 100644 index d74d41b355e..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector/config/php74.php +++ /dev/null @@ -1,13 +0,0 @@ -rule(ReturnTypeFromReturnNewRector::class); - - $rectorConfig->phpVersion(PhpVersionFeature::STATIC_RETURN_TYPE - 1); -}; diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/multi_returns_all_bool.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/multi_returns_all_bool.php.inc deleted file mode 100644 index ebcf08cd98e..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/multi_returns_all_bool.php.inc +++ /dev/null @@ -1,35 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/skip_multi_returns_no_root.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/skip_multi_returns_no_root.php.inc deleted file mode 100644 index 9b3f7ae2d24..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/skip_multi_returns_no_root.php.inc +++ /dev/null @@ -1,17 +0,0 @@ -first() && true; - } - - public function first() - { - return true; - } -} - -?> ------ -first() && true; - } - - public function first(): bool - { - return true; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/some_closure.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/some_closure.php.inc deleted file mode 100644 index 6cd9670bc77..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/some_closure.php.inc +++ /dev/null @@ -1,31 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/void_return_in_inner_function.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/void_return_in_inner_function.php.inc deleted file mode 100644 index 2bcbe43f748..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/void_return_in_inner_function.php.inc +++ /dev/null @@ -1,45 +0,0 @@ -first() && true; - } - - public function first() - { - function () { - return; - }; - - return true; - } -} - -?> ------ -first() && true; - } - - public function first(): bool - { - function () { - return; - }; - - return true; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/yield_parent_inner_function.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/yield_parent_inner_function.php.inc deleted file mode 100644 index b0b8e8198a4..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/Fixture/yield_parent_inner_function.php.inc +++ /dev/null @@ -1,45 +0,0 @@ -first() && true; - } - - public function first() - { - function () { - yield 1; - }; - - return true; - } -} - -?> ------ -first() && true; - } - - public function first(): bool - { - function () { - yield 1; - }; - - return true; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/ReturnTypeFromStrictBoolReturnExprRectorTest.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/ReturnTypeFromStrictBoolReturnExprRectorTest.php deleted file mode 100644 index 316335c6c85..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/ReturnTypeFromStrictBoolReturnExprRectorTest.php +++ /dev/null @@ -1,33 +0,0 @@ -doTestFileInfo($fileInfo); - } - - /** - * @return Iterator - */ - public function provideData(): Iterator - { - return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/config/configured_rule.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/config/configured_rule.php deleted file mode 100644 index c08d3183261..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector/config/configured_rule.php +++ /dev/null @@ -1,10 +0,0 @@ -rule(ReturnTypeFromStrictBoolReturnExprRector::class); -}; diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/Fixture/skip_custom_function.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/Fixture/skip_custom_function.php.inc deleted file mode 100644 index a62152093c6..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/Fixture/skip_custom_function.php.inc +++ /dev/null @@ -1,16 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/Fixture/some_native_method_call.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/Fixture/some_native_method_call.php.inc deleted file mode 100644 index 348abb39078..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/Fixture/some_native_method_call.php.inc +++ /dev/null @@ -1,27 +0,0 @@ -isDir(); - } -} - -?> ------ -isDir(); - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/ReturnTypeFromStrictNativeCallRectorTest.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/ReturnTypeFromStrictNativeCallRectorTest.php deleted file mode 100644 index 272c8123261..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/ReturnTypeFromStrictNativeCallRectorTest.php +++ /dev/null @@ -1,33 +0,0 @@ -doTestFileInfo($fileInfo); - } - - /** - * @return Iterator - */ - public function provideData(): Iterator - { - return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/config/configured_rule.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/config/configured_rule.php deleted file mode 100644 index 016b6df2a5e..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector/config/configured_rule.php +++ /dev/null @@ -1,11 +0,0 @@ -rule(ReturnTypeFromStrictNativeCallRector::class); -}; diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/do_not_change_more_detailed_return_doc.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/do_not_change_more_detailed_return_doc.php.inc deleted file mode 100644 index 97d60952daa..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/do_not_change_more_detailed_return_doc.php.inc +++ /dev/null @@ -1,67 +0,0 @@ - $ParameterArray - * - * @return array - */ - public function getFilterFromParameterArray2($ParameterArray) { - - $filter = [ - 'where' => '', - 'having' => '', - 'from' => '', - ]; - - $where_filter_sql = '1=1'; - - $where_filter_sql .= ' ... '; // sql stuff -> one line is working with reactor - $where_filter_sql .= ' ... '; // sql stuff -> the next lines will break the phpdoc?? - - $filter['where'] = $where_filter_sql; - - return $filter; - } -} - -?> ------ - $ParameterArray - * - * @return array - */ - public function getFilterFromParameterArray2($ParameterArray): array { - - $filter = [ - 'where' => '', - 'having' => '', - 'from' => '', - ]; - - $where_filter_sql = '1=1'; - - $where_filter_sql .= ' ... '; // sql stuff -> one line is working with reactor - $where_filter_sql .= ' ... '; // sql stuff -> the next lines will break the phpdoc?? - - $filter['where'] = $where_filter_sql; - - return $filter; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/do_not_change_more_detailed_return_doc2.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/do_not_change_more_detailed_return_doc2.php.inc deleted file mode 100644 index 53fb0203f7f..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/do_not_change_more_detailed_return_doc2.php.inc +++ /dev/null @@ -1,45 +0,0 @@ - - */ - public function getCsvHeaderArray() { - $HeaderArray = []; - $HeaderArray[] = Resource::_('Mwst'); - - return $HeaderArray; - } -} - -?> ------ - - */ - public function getCsvHeaderArray(): array { - $HeaderArray = []; - $HeaderArray[] = Resource::_('Mwst'); - - return $HeaderArray; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/include_simple_array_shape.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/include_simple_array_shape.php.inc deleted file mode 100644 index aa7194c9e9c..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/include_simple_array_shape.php.inc +++ /dev/null @@ -1,46 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/make_complex_array_shape_simpler.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/make_complex_array_shape_simpler.php.inc deleted file mode 100644 index f84dea9f793..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/make_complex_array_shape_simpler.php.inc +++ /dev/null @@ -1,50 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/make_nested_complex_array_shape_simpler.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/make_nested_complex_array_shape_simpler.php.inc deleted file mode 100644 index 2d6ffa168fe..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/make_nested_complex_array_shape_simpler.php.inc +++ /dev/null @@ -1,56 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/return_override_with_array.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/return_override_with_array.php.inc deleted file mode 100644 index b574bddae8b..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/return_override_with_array.php.inc +++ /dev/null @@ -1,38 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/return_specific_type.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/return_specific_type.php.inc deleted file mode 100644 index 92498d9d4e1..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/return_specific_type.php.inc +++ /dev/null @@ -1,44 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/skip_modified_type_between_assign_and_return.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/skip_modified_type_between_assign_and_return.php.inc deleted file mode 100644 index d0dfb246e19..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/skip_modified_type_between_assign_and_return.php.inc +++ /dev/null @@ -1,20 +0,0 @@ -settings($values); - - return $values; - } - - private function settings(&$values) - { - $values = 1; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/skip_override.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/skip_override.php.inc deleted file mode 100644 index ad7e3d6fadc..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Fixture/skip_override.php.inc +++ /dev/null @@ -1,15 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/ReturnTypeFromStrictNewArrayRectorTest.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/ReturnTypeFromStrictNewArrayRectorTest.php deleted file mode 100644 index ec0195d3090..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/ReturnTypeFromStrictNewArrayRectorTest.php +++ /dev/null @@ -1,33 +0,0 @@ -doTestFileInfo($fileInfo); - } - - /** - * @return Iterator - */ - public function provideData(): Iterator - { - return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Source/AppleJuice.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Source/AppleJuice.php deleted file mode 100644 index 1dcbfb991ae..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector/Source/AppleJuice.php +++ /dev/null @@ -1,9 +0,0 @@ -rule(ReturnTypeFromStrictNewArrayRector::class); -}; diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/also_static_call.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/also_static_call.php.inc deleted file mode 100644 index 5ff8be96128..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/also_static_call.php.inc +++ /dev/null @@ -1,43 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/arrow_function.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/arrow_function.php.inc deleted file mode 100644 index 81854934be5..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/arrow_function.php.inc +++ /dev/null @@ -1,39 +0,0 @@ - App::init(); - -}; - -?> ------ - App::init(); - -}; - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/do_not_return_parent_inner_functionlike_only_has_return.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/do_not_return_parent_inner_functionlike_only_has_return.php.inc deleted file mode 100644 index a72c711a46d..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/do_not_return_parent_inner_functionlike_only_has_return.php.inc +++ /dev/null @@ -1,65 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/external_caller.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/external_caller.php.inc deleted file mode 100644 index c05e087f119..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/external_caller.php.inc +++ /dev/null @@ -1,31 +0,0 @@ -getName(); - } -} - -?> ------ -getName(); - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/external_static_caller.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/external_static_caller.php.inc deleted file mode 100644 index 048b17bc96f..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/external_static_caller.php.inc +++ /dev/null @@ -1,31 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/inner_functionlike_and_parent_has_return.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/inner_functionlike_and_parent_has_return.php.inc deleted file mode 100644 index 7da3705f502..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/inner_functionlike_and_parent_has_return.php.inc +++ /dev/null @@ -1,69 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_function.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_function.php.inc deleted file mode 100644 index 412200cd786..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_function.php.inc +++ /dev/null @@ -1,37 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_self_different_namespace.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_self_different_namespace.php.inc deleted file mode 100644 index f802743332c..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_self_different_namespace.php.inc +++ /dev/null @@ -1,37 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_self_different_namespace_nullable.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_self_different_namespace_nullable.php.inc deleted file mode 100644 index dc6007bef05..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_self_different_namespace_nullable.php.inc +++ /dev/null @@ -1,37 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_arrow_function_void.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_arrow_function_void.php.inc deleted file mode 100644 index bfabd222ef9..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_arrow_function_void.php.inc +++ /dev/null @@ -1,13 +0,0 @@ - $callWithVoid->nothing(); - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_constructor_for_void.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_constructor_for_void.php.inc deleted file mode 100644 index 12d599fccad..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_constructor_for_void.php.inc +++ /dev/null @@ -1,11 +0,0 @@ -fakedTypes(); - } - - /** - * @return bool - */ - private function fakedTypes() - { - return 100; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_interface_for_void.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_interface_for_void.php.inc deleted file mode 100644 index e4ca22abb53..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_interface_for_void.php.inc +++ /dev/null @@ -1,8 +0,0 @@ -getNumber(); - } - - return $this->getRandom(); - } - - private function getNumber(): int - { - return 100; - } - - private function getRandom() - { - if (mt_rand(0, 1)) { - return true; - } - - return '...'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_possible_no_return.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_possible_no_return.php.inc deleted file mode 100644 index d36ac3ef565..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_possible_no_return.php.inc +++ /dev/null @@ -1,18 +0,0 @@ -getNumber(); - } - } - - private function getNumber(): int - { - return 100; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_twice_different_type.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_twice_different_type.php.inc deleted file mode 100644 index f7300f84b26..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_twice_different_type.php.inc +++ /dev/null @@ -1,25 +0,0 @@ -getNumber(); - } - - return $this->getString(); - } - - private function getNumber(): int - { - return 100; - } - - private function getString(): string - { - return 'hey'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/some_class.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/some_class.php.inc deleted file mode 100644 index f2406fce96d..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/some_class.php.inc +++ /dev/null @@ -1,37 +0,0 @@ -getNumber(); - } - - private function getNumber(): int - { - return 1000; - } -} - -?> ------ -getNumber(); - } - - private function getNumber(): int - { - return 1000; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/twice_same_type.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/twice_same_type.php.inc deleted file mode 100644 index 5c96d7fd2ed..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/twice_same_type.php.inc +++ /dev/null @@ -1,45 +0,0 @@ -getNumber(100); - } - - return $this->getNumber(10); - } - - private function getNumber(int $value): int - { - return $value; - } -} - -?> ------ -getNumber(100); - } - - return $this->getNumber(10); - } - - private function getNumber(int $value): int - { - return $value; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/use_return_self.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/use_return_self.php.inc deleted file mode 100644 index 500558b57b7..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/use_return_self.php.inc +++ /dev/null @@ -1,47 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/use_return_self_nullable.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/use_return_self_nullable.php.inc deleted file mode 100644 index 1b80abc79ac..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/use_return_self_nullable.php.inc +++ /dev/null @@ -1,55 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/mix_of_nullable_types.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/mix_of_nullable_types.php.inc deleted file mode 100644 index a5d43dd4578..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/mix_of_nullable_types.php.inc +++ /dev/null @@ -1,55 +0,0 @@ -getFirstMix(); - } - - return $this->getSecondMixed(); - } - - private function getFirstMix(): ?int - { - return 100; - } - - private function getSecondMixed(): ?string - { - return 'hey'; - } -} - -?> ------ -getFirstMix(); - } - - return $this->getSecondMixed(); - } - - private function getFirstMix(): ?int - { - return 100; - } - - private function getSecondMixed(): ?string - { - return 'hey'; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/mix_of_union_types.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/mix_of_union_types.php.inc deleted file mode 100644 index a4d75be1fdf..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/mix_of_union_types.php.inc +++ /dev/null @@ -1,55 +0,0 @@ -getFirstMix(); - } - - return $this->getSecondMixed(); - } - - private function getFirstMix(): int|string - { - return 100; - } - - private function getSecondMixed(): string|bool - { - return 'hey'; - } -} - -?> ------ -getFirstMix(); - } - - return $this->getSecondMixed(); - } - - private function getFirstMix(): int|string - { - return 100; - } - - private function getSecondMixed(): string|bool - { - return 'hey'; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/twice_different_type.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/twice_different_type.php.inc deleted file mode 100644 index 48c45e13a97..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/twice_different_type.php.inc +++ /dev/null @@ -1,55 +0,0 @@ -getNumber(); - } - - return $this->getString(); - } - - private function getNumber(): int - { - return 100; - } - - private function getString(): string - { - return 'hey'; - } -} - -?> ------ -getNumber(); - } - - return $this->getString(); - } - - private function getNumber(): int - { - return 100; - } - - private function getString(): string - { - return 'hey'; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Php80Test.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Php80Test.php deleted file mode 100644 index 772694be2ab..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Php80Test.php +++ /dev/null @@ -1,33 +0,0 @@ -doTestFileInfo($fileInfo); - } - - /** - * @return Iterator - */ - public function provideData(): Iterator - { - return $this->yieldFilesFromDirectory(__DIR__ . '/FixturePhp80'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/php80_rule.php'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/ReturnTypeFromStrictTypedCallRectorTest.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/ReturnTypeFromStrictTypedCallRectorTest.php deleted file mode 100644 index 7cdacfa3537..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/ReturnTypeFromStrictTypedCallRectorTest.php +++ /dev/null @@ -1,33 +0,0 @@ -doTestFileInfo($fileInfo); - } - - /** - * @return Iterator - */ - public function provideData(): Iterator - { - return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Source/CallWithVoid.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Source/CallWithVoid.php deleted file mode 100644 index a0c3793e0ff..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Source/CallWithVoid.php +++ /dev/null @@ -1,12 +0,0 @@ -rule(ReturnTypeFromStrictTypedCallRector::class); - - $rectorConfig->phpVersion(PhpVersionFeature::UNION_TYPES - 1); -}; diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/config/php80_rule.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/config/php80_rule.php deleted file mode 100644 index 13cec2bea25..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/config/php80_rule.php +++ /dev/null @@ -1,13 +0,0 @@ -rule(ReturnTypeFromStrictTypedCallRector::class); - - $rectorConfig->phpVersion(PhpVersion::PHP_80); -}; diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/inner_classmethod.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/inner_classmethod.php.inc deleted file mode 100644 index ce2e8d4bda3..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/inner_classmethod.php.inc +++ /dev/null @@ -1,39 +0,0 @@ -age; - } - }; - } -} - -?> ------ -age; - } - }; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/skip_doc_type.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/skip_doc_type.php.inc deleted file mode 100644 index cc50dddbb84..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/skip_doc_type.php.inc +++ /dev/null @@ -1,16 +0,0 @@ -age; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/skip_one_missing_type.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/skip_one_missing_type.php.inc deleted file mode 100644 index ca1f13c0bef..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/skip_one_missing_type.php.inc +++ /dev/null @@ -1,22 +0,0 @@ -age; - } - - return $this->name; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/skip_single_void.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/skip_single_void.php.inc deleted file mode 100644 index 08849503b43..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/skip_single_void.php.inc +++ /dev/null @@ -1,17 +0,0 @@ -age; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/some_class.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/some_class.php.inc deleted file mode 100644 index 007fc7f4892..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/some_class.php.inc +++ /dev/null @@ -1,31 +0,0 @@ -age; - } -} - -?> ------ -age; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/some_union_type.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/some_union_type.php.inc deleted file mode 100644 index 5b09c8e3d3b..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/some_union_type.php.inc +++ /dev/null @@ -1,31 +0,0 @@ -age; - } -} - -?> ------ -age; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/two_returns_union_type.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/two_returns_union_type.php.inc deleted file mode 100644 index d8a1df93c85..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/Fixture/two_returns_union_type.php.inc +++ /dev/null @@ -1,43 +0,0 @@ -age; - } - - return $this->name; - } -} - -?> ------ -age; - } - - return $this->name; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/ReturnTypeFromStrictTypedPropertyRectorTest.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/ReturnTypeFromStrictTypedPropertyRectorTest.php deleted file mode 100644 index b5ac69593ff..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/ReturnTypeFromStrictTypedPropertyRectorTest.php +++ /dev/null @@ -1,33 +0,0 @@ -doTestFileInfo($fileInfo); - } - - /** - * @return Iterator - */ - public function provideData(): Iterator - { - return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/config/configured_rule.php b/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/config/configured_rule.php deleted file mode 100644 index def7077118c..00000000000 --- a/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector/config/configured_rule.php +++ /dev/null @@ -1,10 +0,0 @@ -rule(ReturnTypeFromStrictTypedPropertyRector::class); -}; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php deleted file mode 100644 index f763bb0672b..00000000000 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php +++ /dev/null @@ -1,185 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [ClassMethod::class, Function_::class, Closure::class, ArrowFunction::class]; - } - - /** - * @param ClassMethod|Function_|ArrowFunction $node - */ - public function refactor(Node $node): ?Node - { - if ($node->returnType !== null) { - return null; - } - - if (! $node instanceof ArrowFunction) { - $returnedNewClassName = $this->strictReturnNewAnalyzer->matchAlwaysReturnVariableNew($node); - if (is_string($returnedNewClassName)) { - $node->returnType = new FullyQualified($returnedNewClassName); - - return $node; - } - } - - return $this->refactorDirectReturnNew($node); - } - - public function provideMinPhpVersion(): int - { - return PhpVersionFeature::SCALAR_TYPES; - } - - private function createObjectTypeFromNew(New_ $new): ObjectType|StaticType - { - $className = $this->getName($new->class); - if ($className === null) { - throw new ShouldNotHappenException(); - } - - if ($className === ObjectReference::STATIC || $className === ObjectReference::SELF) { - $classReflection = $this->reflectionResolver->resolveClassReflection($new); - if (! $classReflection instanceof ClassReflection) { - throw new ShouldNotHappenException(); - } - - if ($className === ObjectReference::SELF) { - return new SelfStaticType($classReflection); - } - - return new StaticType($classReflection); - } - - $classReflection = $this->reflectionProvider->getClass($className); - return new ObjectType($className, null, $classReflection); - } - - private function refactorDirectReturnNew( - ClassMethod|Function_|ArrowFunction|Closure $node - ): null|ArrowFunction|Function_|ClassMethod|Closure { - if ($node instanceof ArrowFunction) { - $returns = [new Return_($node->expr)]; - } else { - /** @var Return_[] $returns */ - $returns = $this->betterNodeFinder->findInstancesOfInFunctionLikeScoped($node, Return_::class); - } - - if ($returns === []) { - return null; - } - - $newTypes = $this->resolveReturnNewType($returns); - if ($newTypes === null) { - return null; - } - - $returnType = $this->typeFactory->createMixedPassedOrUnionType($newTypes); - - $returnTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($returnType, TypeKind::RETURN); - if (! $returnTypeNode instanceof Node) { - return null; - } - - $node->returnType = $returnTypeNode; - - return $node; - } - - /** - * @param Return_[] $returns - * @return Type[]|null - */ - private function resolveReturnNewType(array $returns): ?array - { - $newTypes = []; - foreach ($returns as $return) { - if (! $return->expr instanceof New_) { - return null; - } - - $new = $return->expr; - if (! $new->class instanceof Name) { - return null; - } - - $newTypes[] = $this->createObjectTypeFromNew($new); - } - - return $newTypes; - } -} diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector.php deleted file mode 100644 index 3531b7a29b9..00000000000 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictBoolReturnExprRector.php +++ /dev/null @@ -1,86 +0,0 @@ -first() && $this->somethingElse(); - } -} -CODE_SAMPLE - - , - <<<'CODE_SAMPLE' -final class SomeClass -{ - public function run(): bool - { - return $this->first() && $this->somethingElse(); - } -} -CODE_SAMPLE - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [ClassMethod::class, Function_::class, Closure::class]; - } - - /** - * @param ClassMethod|Function_|Closure $node - */ - public function refactor(Node $node): ?Node - { - if ($node->returnType !== null) { - return null; - } - - if (! $this->strictBoolReturnTypeAnalyzer->hasAlwaysStrictBoolReturn($node)) { - return null; - } - - $node->returnType = new Identifier('bool'); - return $node; - } - - public function provideMinPhpVersion(): int - { - return PhpVersion::PHP_70; - } -} diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector.php deleted file mode 100644 index 7c555a7d805..00000000000 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector.php +++ /dev/null @@ -1,105 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [ClassMethod::class, Closure::class, Function_::class]; - } - - /** - * @param ClassMethod|Closure|Function_ $node - */ - public function refactor(Node $node): ?Node - { - if ($node->returnType !== null) { - return null; - } - - $nativeCallLikes = $this->strictNativeFunctionReturnTypeAnalyzer->matchAlwaysReturnNativeCallLikes($node); - if ($nativeCallLikes === null) { - return null; - } - - $callLikeTypes = []; - foreach ($nativeCallLikes as $nativeCallLike) { - $callLikeTypes[] = $this->getType($nativeCallLike); - } - - $returnType = $this->typeFactory->createMixedPassedOrUnionType($callLikeTypes); - if ($returnType instanceof MixedType) { - return null; - } - - $returnTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($returnType, TypeKind::RETURN); - if (! $returnTypeNode instanceof Node) { - return null; - } - - $node->returnType = $returnTypeNode; - return $node; - } - - public function provideMinPhpVersion(): int - { - return PhpVersion::PHP_70; - } -} diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php deleted file mode 100644 index c93149fa9ec..00000000000 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php +++ /dev/null @@ -1,247 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [ClassMethod::class, Function_::class, Closure::class]; - } - - /** - * @param ClassMethod|Function_|Closure $node - */ - public function refactor(Node $node): ?Node - { - if ($node->returnType !== null) { - return null; - } - - // 1. is variable instantiated with array - $stmts = $node->stmts; - if ($stmts === null) { - return null; - } - - $variable = $this->matchArrayAssignedVariable($stmts); - if (! $variable instanceof Variable) { - return null; - } - - // 2. skip yields - if ($this->betterNodeFinder->hasInstancesOfInFunctionLikeScoped($node, [Yield_::class])) { - return null; - } - - /** @var Return_[] $returns */ - $returns = $this->betterNodeFinder->findInstancesOfInFunctionLikeScoped($node, Return_::class); - if (count($returns) !== 1) { - return null; - } - - if ($this->isVariableOverriddenWithNonArray($node, $variable)) { - return null; - } - - $onlyReturn = $returns[0]; - if (! $onlyReturn->expr instanceof Variable) { - return null; - } - - $returnType = $this->nodeTypeResolver->getType($onlyReturn->expr); - - if (! $returnType instanceof ArrayType) { - return null; - } - - if (! $this->nodeNameResolver->areNamesEqual($onlyReturn->expr, $variable)) { - return null; - } - - // 3. always returns array - $node->returnType = new Identifier('array'); - - // 4. add more precise type if suitable - $exprType = $this->getType($onlyReturn->expr); - - if ($this->shouldAddReturnArrayDocType($exprType)) { - $this->changeReturnType($node, $exprType); - } - - return $node; - } - - public function provideMinPhpVersion(): int - { - return PhpVersion::PHP_70; - } - - private function changeReturnType(Node $node, Type $exprType): void - { - $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node); - - $exprType = $this->narrowConstantArrayType($exprType); - - if (! $this->typeComparator->isSubtype($phpDocInfo->getReturnType(), $exprType)) { - $this->phpDocTypeChanger->changeReturnType($phpDocInfo, $exprType); - } - } - - private function isVariableOverriddenWithNonArray( - ClassMethod|Function_|Closure $functionLike, - Variable $variable - ): bool { - // is variable overriden? - /** @var Assign[] $assigns */ - $assigns = $this->betterNodeFinder->findInstancesOfInFunctionLikeScoped($functionLike, Assign::class); - foreach ($assigns as $assign) { - if (! $assign->var instanceof Variable) { - continue; - } - - if (! $this->nodeNameResolver->areNamesEqual($assign->var, $variable)) { - continue; - } - - if (! $assign->expr instanceof Array_) { - return true; - } - } - - return false; - } - - /** - * @param Stmt[] $stmts - */ - private function matchArrayAssignedVariable(array $stmts): Variable|null - { - foreach ($stmts as $stmt) { - if (! $stmt instanceof Expression) { - continue; - } - - if (! $stmt->expr instanceof Assign) { - continue; - } - - $assign = $stmt->expr; - if (! $assign->var instanceof Variable) { - continue; - } - - if (! $assign->expr instanceof Array_) { - continue; - } - - return $assign->var; - } - - return null; - } - - private function shouldAddReturnArrayDocType(Type $exprType): bool - { - if ($exprType instanceof ConstantArrayType) { - // sign of empty array, keep empty - return ! $exprType->getItemType() instanceof NeverType; - } - - return $exprType instanceof ArrayType; - } - - private function narrowConstantArrayType(Type $type): Type - { - if (! $type instanceof ConstantArrayType) { - return $type; - } - - if (count($type->getValueTypes()) === 1) { - $singleValueType = $type->getValueTypes()[0]; - if ($singleValueType instanceof ObjectType) { - return $type; - } - } - - $printedDescription = $type->describe(VerbosityLevel::precise()); - if (strlen($printedDescription) > 50) { - return new ArrayType(new MixedType(), new MixedType()); - } - - return $type; - } -} diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php deleted file mode 100644 index 7e2608d093c..00000000000 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php +++ /dev/null @@ -1,241 +0,0 @@ -getNumber(); - } - - private function getNumber(): int - { - return 1000; - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -final class SomeClass -{ - public function getData(): int - { - return $this->getNumber(); - } - - private function getNumber(): int - { - return 1000; - } -} -CODE_SAMPLE - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [ClassMethod::class, Function_::class, Closure::class, ArrowFunction::class]; - } - - /** - * @param ClassMethod|Function_|Closure|ArrowFunction $node - */ - public function refactor(Node $node): ?Node - { - if ($this->isSkipped($node)) { - return null; - } - - if ($node instanceof ArrowFunction) { - return $this->processArrowFunction($node); - } - - /** @var Return_[] $returns */ - $returns = $this->betterNodeFinder->find((array) $node->stmts, function (Node $subNode) use ($node): bool { - $currentFunctionLike = $this->betterNodeFinder->findParentType($subNode, FunctionLike::class); - - if ($currentFunctionLike === $node) { - return $subNode instanceof Return_; - } - - $currentReturn = $this->betterNodeFinder->findParentType($subNode, Return_::class); - if (! $currentReturn instanceof Return_) { - return false; - } - - $currentFunctionLike = $this->betterNodeFinder->findParentType($currentReturn, FunctionLike::class); - if ($currentFunctionLike !== $node) { - return false; - } - - return $subNode instanceof Return_; - }); - - $returnedStrictTypes = $this->returnStrictTypeAnalyzer->collectStrictReturnTypes($returns); - if ($returnedStrictTypes === []) { - return null; - } - - if (count($returnedStrictTypes) === 1) { - return $this->refactorSingleReturnType($returns[0], $returnedStrictTypes[0], $node); - } - - if ($this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::UNION_TYPES)) { - /** @var PhpParserUnionType[] $returnedStrictTypes */ - $unwrappedTypes = $this->typeNodeUnwrapper->unwrapNullableUnionTypes($returnedStrictTypes); - $node->returnType = new PhpParserUnionType($unwrappedTypes); - - return $node; - } - - return null; - } - - private function processArrowFunction(ArrowFunction $arrowFunction): ?ArrowFunction - { - $resolvedType = $this->nodeTypeResolver->getType($arrowFunction->expr); - - // void type is not accepted for arrow functions - https://www.php.net/manual/en/functions.arrow.php#125673 - if ($resolvedType instanceof VoidType) { - return null; - } - - $returnType = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($resolvedType, TypeKind::RETURN); - - if (! $returnType instanceof Node) { - return null; - } - - $arrowFunction->returnType = $returnType; - return $arrowFunction; - } - - private function isUnionPossibleReturnsVoid(ClassMethod | Function_ | Closure $node): bool - { - $inferReturnType = $this->returnTypeInferer->inferFunctionLike($node); - if ($inferReturnType instanceof UnionType) { - foreach ($inferReturnType->getTypes() as $type) { - if ($type instanceof VoidType) { - return true; - } - } - } - - return false; - } - - private function processSingleUnionType( - ClassMethod | Function_ | Closure $node, - UnionType $unionType, - NullableType $nullableType - ): Closure | ClassMethod | Function_ { - $types = $unionType->getTypes(); - $returnType = $types[0] instanceof ObjectType && $types[1] instanceof NullType - ? new NullableType(new FullyQualified($types[0]->getClassName())) - : $nullableType; - - $node->returnType = $returnType; - return $node; - } - - private function isSkipped(ClassMethod | Function_ | Closure | ArrowFunction $node): bool - { - if (! $this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::SCALAR_TYPES)) { - return true; - } - - if ($node instanceof ArrowFunction) { - return $node->returnType !== null; - } - - if ($node->returnType !== null) { - return true; - } - - if (! $node instanceof ClassMethod) { - return $this->isUnionPossibleReturnsVoid($node); - } - - if (! $node->isMagic()) { - return $this->isUnionPossibleReturnsVoid($node); - } - - return true; - } - - private function refactorSingleReturnType( - Return_ $return, - Identifier|Name|NullableType $returnedStrictTypeNode, - ClassMethod | Function_ | Closure $functionLike - ): Closure | ClassMethod | Function_ { - $resolvedType = $this->nodeTypeResolver->getType($return); - - if ($resolvedType instanceof UnionType) { - if (! $returnedStrictTypeNode instanceof NullableType) { - return $functionLike; - } - - return $this->processSingleUnionType($functionLike, $resolvedType, $returnedStrictTypeNode); - } - - /** @var Name $returnType */ - $returnType = $resolvedType instanceof ObjectType - ? new FullyQualified($resolvedType->getClassName()) - : $returnedStrictTypeNode; - - $functionLike->returnType = $returnType; - - return $functionLike; - } -} diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php deleted file mode 100644 index 960cc5f16f8..00000000000 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php +++ /dev/null @@ -1,145 +0,0 @@ -age; - } -} -CODE_SAMPLE - - , - <<<'CODE_SAMPLE' -final class SomeClass -{ - private int $age = 100; - - public function getAge(): int - { - return $this->age; - } -} -CODE_SAMPLE - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [ClassMethod::class]; - } - - /** - * @param ClassMethod $node - */ - public function refactor(Node $node): ?Node - { - if ($node->returnType !== null) { - return null; - } - - $propertyTypes = $this->resolveReturnPropertyType($node); - if ($propertyTypes === []) { - return null; - } - - // add type to return type - $propertyType = $this->typeFactory->createMixedPassedOrUnionType($propertyTypes); - if ($propertyType instanceof MixedType) { - return null; - } - - $propertyTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($propertyType, TypeKind::RETURN); - if (! $propertyTypeNode instanceof Node) { - return null; - } - - $node->returnType = $propertyTypeNode; - - return $node; - } - - public function provideMinPhpVersion(): int - { - return PhpVersionFeature::TYPED_PROPERTIES; - } - - /** - * @return Type[] - */ - private function resolveReturnPropertyType(ClassMethod $classMethod): array - { - /** @var Return_[] $returns */ - $returns = $this->betterNodeFinder->findInstancesOfInFunctionLikeScoped($classMethod, Return_::class); - - $propertyTypes = []; - - foreach ($returns as $return) { - if ($return->expr === null) { - return []; - } - - if (! $return->expr instanceof PropertyFetch) { - return []; - } - - $phpPropertyReflection = $this->reflectionResolver->resolvePropertyReflectionFromPropertyFetch( - $return->expr - ); - if (! $phpPropertyReflection instanceof PhpPropertyReflection) { - return []; - } - - // all property must have type declaration - if ($phpPropertyReflection->getNativeType() instanceof MixedType) { - return []; - } - - $propertyTypes[] = $phpPropertyReflection->getNativeType(); - } - - return $propertyTypes; - } -} diff --git a/rules/TypeDeclaration/TypeNormalizer.php b/rules/TypeDeclaration/TypeNormalizer.php index 282f1bccf0d..8ba846cf2ea 100644 --- a/rules/TypeDeclaration/TypeNormalizer.php +++ b/rules/TypeDeclaration/TypeNormalizer.php @@ -68,6 +68,9 @@ public function convertConstantArrayTypeToArrayType(ConstantArrayType $constantA */ public function normalizeArrayOfUnionToUnionArray(Type $type, int $arrayNesting = 1): Type { + dump($type); + die; + if (! $type instanceof ArrayType) { return $type; }