From f8dde395a17dac67a96ada4f21d36e3f357f98d6 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Thu, 18 Jul 2024 21:46:19 +0200 Subject: [PATCH 01/18] Add Symfony 7 Support --- .php-cs-fixer.cache | 1 + DependencyInjection/Configuration.php | 2 +- Resources/config/gone_subscriber.xml | 2 +- composer.json | 22 +++++++++++----------- 4 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 .php-cs-fixer.cache diff --git a/.php-cs-fixer.cache b/.php-cs-fixer.cache new file mode 100644 index 0000000..1fab8e0 --- /dev/null +++ b/.php-cs-fixer.cache @@ -0,0 +1 @@ +{"php":"8.3.6","version":"3.59.3","indent":" ","lineEnding":"\n","rules":{"align_multiline_comment":true,"array_syntax":{"syntax":"short"},"backtick_to_shell_exec":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["return"]},"braces_position":{"allow_single_line_anonymous_functions":true,"allow_single_line_empty_anonymous_classes":true},"class_attributes_separation":{"elements":{"method":"one"}},"class_reference_name_casing":true,"clean_namespace":true,"concat_space":{"spacing":"one"},"declare_parentheses":true,"echo_tag_syntax":true,"empty_loop_body":{"style":"braces"},"empty_loop_condition":true,"fully_qualified_strict_types":true,"function_declaration":{"closure_function_spacing":"none"},"general_phpdoc_tag_rename":{"replacements":{"inheritDocs":"inheritDoc"}},"global_namespace_import":{"import_classes":false,"import_constants":false,"import_functions":false},"include":true,"increment_style":true,"integer_literal_case":true,"lambda_not_used_import":true,"linebreak_after_opening_tag":true,"magic_constant_casing":true,"magic_method_casing":true,"method_argument_space":{"on_multiline":"ignore"},"native_function_casing":true,"native_type_declaration_casing":true,"no_alias_language_construct_call":true,"no_alternative_syntax":true,"no_binary_string":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["attribute","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","square_brace_block","switch","throw","use"]},"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_null_property_initialization":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"allow_hidden_params":true,"remove_inheritdoc":true},"no_trailing_comma_in_singleline":true,"no_unneeded_braces":{"namespaces":true},"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","others","return","switch_case","yield","yield_from"]},"no_unneeded_import_alias":true,"no_unset_cast":true,"no_unused_imports":true,"no_useless_concat_operator":true,"no_useless_nullsafe_operator":true,"no_whitespace_before_comma_in_array":true,"normalize_index_brace":true,"nullable_type_declaration":true,"nullable_type_declaration_for_default_null_value":true,"object_operator_without_whitespace":true,"operator_linebreak":{"only_booleans":true},"ordered_imports":true,"ordered_types":{"null_adjustment":"always_last","sort_algorithm":"none"},"php_unit_fqcn_annotation":true,"php_unit_method_casing":true,"phpdoc_align":{"align":"left"},"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_order":{"order":["param","return","throws"]},"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":{"groups":[["Annotation","NamedArgumentConstructor","Target"],["author","copyright","license"],["category","package","subpackage"],["property","property-read","property-write"],["deprecated","link","see","since"]]},"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_tag_type":{"tags":{"inheritDoc":"inline"}},"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_var_without_name":true,"semicolon_after_instruction":true,"simple_to_complex_string_variable":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_comment_spacing":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"single_space_around_construct":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"statement_indentation":{"stick_comment_to_next_continuous_control_statement":true},"switch_continue_to_break":true,"trailing_comma_in_multiline":true,"trim_array_spaces":true,"type_declaration_spaces":true,"types_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"yoda_style":true,"array_indentation":true,"cast_spaces":true,"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_parentheses":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"return_type_declaration":true,"short_scalar_cast":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_line_after_imports":true,"spaces_inside_parentheses":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"header_comment":{"header":"This file is part of Sulu.\n\n(c) Sulu GmbH\n\nThis source file is subject to the MIT license that is bundled\nwith this source code in the file LICENSE."}},"hashes":{"\/private\/var\/folders\/02\/38pv02ln53sf66jz76rj189m0000gn\/T\/PHP CS Fixertemp_folder415\/DependencyInjection\/Configuration.php":"fc7a93d87c407e10fcb2611bd689efe4","\/private\/var\/folders\/02\/38pv02ln53sf66jz76rj189m0000gn\/T\/PHP CS Fixertemp_folder121\/DependencyInjection\/Configuration.php":"fc7a93d87c407e10fcb2611bd689efe4","\/private\/var\/folders\/02\/38pv02ln53sf66jz76rj189m0000gn\/T\/PHP CS Fixertemp_folder1303\/DependencyInjection\/Configuration.php":"c3ce9e4dc7c15c60b05bed438bec7d8f","\/private\/var\/folders\/02\/38pv02ln53sf66jz76rj189m0000gn\/T\/PHP CS Fixertemp_folder598\/DependencyInjection\/Configuration.php":"c3ce9e4dc7c15c60b05bed438bec7d8f"}} \ No newline at end of file diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index d96b229..c288a47 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -21,7 +21,7 @@ */ class Configuration implements ConfigurationInterface { - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('sulu_redirect'); $treeBuilder->getRootNode() diff --git a/Resources/config/gone_subscriber.xml b/Resources/config/gone_subscriber.xml index 45add9f..01ca47f 100644 --- a/Resources/config/gone_subscriber.xml +++ b/Resources/config/gone_subscriber.xml @@ -19,7 +19,7 @@ class="Sulu\Bundle\RedirectBundle\GoneSubscriber\GoneEntitySubscriber"> - + diff --git a/composer.json b/composer.json index a7d8120..e7398b3 100644 --- a/composer.json +++ b/composer.json @@ -7,18 +7,18 @@ "php": "^7.2 || ^8.0", "sulu/sulu": "^2.2.5 || ^2.3@dev", "ramsey/uuid": "^3.1 || ^4.0", - "symfony/dependency-injection": "^4.3 || ^5.0 || ^6.0", - "symfony/config": "^4.3 || ^5.0 || ^6.0", - "symfony/console": "^4.3 || ^5.0 || ^6.0", - "symfony/http-foundation": "^4.3 || ^5.0 || ^6.0", + "symfony/dependency-injection": "^4.3 || ^5.0 || ^6.0 || ^6.0", + "symfony/config": "^4.3 || ^5.0 || ^6.0 || ^6.0", + "symfony/console": "^4.3 || ^5.0 || ^6.0 || ^6.0", + "symfony/http-foundation": "^4.3 || ^5.0 || ^6.0 || ^6.0", "handcraftedinthealps/rest-routing-bundle": "^1.0", "friendsofsymfony/rest-bundle": "^2.8 || ^3.0", "jms/serializer-bundle": "^3.0 || ^4.0 || ^5.0", - "symfony/http-kernel": "^4.3 || ^5.0 || ^6.0", + "symfony/http-kernel": "^4.3 || ^5.0 || ^6.0 || ^6.0", "doctrine/orm": "^2.5.3", - "symfony/event-dispatcher": "^4.3 || ^5.0 || ^6.0", - "symfony/property-access": "^4.3 || ^5.0 || ^6.0", - "symfony/routing": "^4.3 || ^5.0 || ^6.0", + "symfony/event-dispatcher": "^4.3 || ^5.0 || ^6.0 || ^6.0", + "symfony/property-access": "^4.3 || ^5.0 || ^6.0 || ^6.0", + "symfony/routing": "^4.3 || ^5.0 || ^6.0 || ^6.0", "symfony-cmf/routing": "^2.1 || ^3.0" }, "require-dev": { @@ -30,12 +30,12 @@ "phpstan/phpstan-symfony": "^1.0", "phpunit/phpunit": "^8.0", "php-cs-fixer/shim": "^3.0", - "symfony/browser-kit": "^4.3 || ^5.0 || ^6.0", - "symfony/dotenv": "^4.3 || ^5.0 || ^6.0", + "symfony/browser-kit": "^4.3 || ^5.0 || ^6.0 || ^6.0", + "symfony/dotenv": "^4.3 || ^5.0 || ^6.0 || ^6.0", "symfony/monolog-bundle": "^3.1", "jackalope/jackalope-doctrine-dbal": "^1.3.4", "handcraftedinthealps/zendsearch": "^2.0", - "symfony/framework-bundle": "^4.3 || ^5.0 || ^6.0", + "symfony/framework-bundle": "^4.3 || ^5.0 || ^6.0 || ^6.0", "phpspec/prophecy": "^1.10" }, "keywords": [ From 54b9fd4d28360bb4ec393bc5c39190e1da84e605 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Thu, 18 Jul 2024 21:53:16 +0200 Subject: [PATCH 02/18] Remove Subscriber interface --- GoneSubscriber/GoneEntitySubscriber.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/GoneSubscriber/GoneEntitySubscriber.php b/GoneSubscriber/GoneEntitySubscriber.php index 1e0ba40..d73f885 100644 --- a/GoneSubscriber/GoneEntitySubscriber.php +++ b/GoneSubscriber/GoneEntitySubscriber.php @@ -11,9 +11,7 @@ namespace Sulu\Bundle\RedirectBundle\GoneSubscriber; -use Doctrine\Common\EventSubscriber; use Doctrine\ORM\Event\LifecycleEventArgs; -use Doctrine\ORM\Events; use Sulu\Bundle\RedirectBundle\Entity\RedirectRoute; use Sulu\Bundle\RedirectBundle\Exception\RedirectRouteNotUniqueException; use Sulu\Bundle\RedirectBundle\Manager\RedirectRouteManagerInterface; @@ -26,7 +24,7 @@ * * @internal this is a internal listener which should not be used directly */ -class GoneEntitySubscriber implements EventSubscriber, ContainerAwareInterface +class GoneEntitySubscriber implements ContainerAwareInterface { use ContainerAwareTrait; @@ -41,13 +39,6 @@ public function __construct( $this->redirectRouteManager = $redirectRouteManager; } - public function getSubscribedEvents() - { - return [ - Events::preRemove, - ]; - } - public function preRemove(LifecycleEventArgs $event): void { $route = $event->getObject(); From 4a6e1d1f9e4bd13aff12faaeca2a736e4ba2551a Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Thu, 18 Jul 2024 21:55:18 +0200 Subject: [PATCH 03/18] Remove interface --- GoneSubscriber/GoneEntitySubscriber.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/GoneSubscriber/GoneEntitySubscriber.php b/GoneSubscriber/GoneEntitySubscriber.php index d73f885..f5d5b11 100644 --- a/GoneSubscriber/GoneEntitySubscriber.php +++ b/GoneSubscriber/GoneEntitySubscriber.php @@ -16,18 +16,15 @@ use Sulu\Bundle\RedirectBundle\Exception\RedirectRouteNotUniqueException; use Sulu\Bundle\RedirectBundle\Manager\RedirectRouteManagerInterface; use Sulu\Bundle\RouteBundle\Model\RouteInterface; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; + /** * This gone subscriber listens for removed route entities. * * @internal this is a internal listener which should not be used directly */ -class GoneEntitySubscriber implements ContainerAwareInterface +class GoneEntitySubscriber { - use ContainerAwareTrait; - /** * @var RedirectRouteManagerInterface */ From 4b5766f09ba2465d549d7cc0f9ec43572bc53aab Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Thu, 18 Jul 2024 21:58:51 +0200 Subject: [PATCH 04/18] set LifecycleEventArgs --- Resources/config/gone_subscriber.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/config/gone_subscriber.xml b/Resources/config/gone_subscriber.xml index 01ca47f..7f8dce8 100644 --- a/Resources/config/gone_subscriber.xml +++ b/Resources/config/gone_subscriber.xml @@ -19,7 +19,7 @@ class="Sulu\Bundle\RedirectBundle\GoneSubscriber\GoneEntitySubscriber"> - + From 2dfeab2b599b1fdbad4e6434c7b150f923f092ec Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Thu, 18 Jul 2024 22:05:01 +0200 Subject: [PATCH 05/18] Remove emtpy line --- GoneSubscriber/GoneEntitySubscriber.php | 1 - 1 file changed, 1 deletion(-) diff --git a/GoneSubscriber/GoneEntitySubscriber.php b/GoneSubscriber/GoneEntitySubscriber.php index f5d5b11..8ffd51f 100644 --- a/GoneSubscriber/GoneEntitySubscriber.php +++ b/GoneSubscriber/GoneEntitySubscriber.php @@ -17,7 +17,6 @@ use Sulu\Bundle\RedirectBundle\Manager\RedirectRouteManagerInterface; use Sulu\Bundle\RouteBundle\Model\RouteInterface; - /** * This gone subscriber listens for removed route entities. * From 28c217adfcc87474680349773c84c6da485fc267 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Fri, 19 Jul 2024 09:12:30 +0200 Subject: [PATCH 06/18] Remove php-cs-fixer.cache --- .php-cs-fixer.cache | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .php-cs-fixer.cache diff --git a/.php-cs-fixer.cache b/.php-cs-fixer.cache deleted file mode 100644 index 1fab8e0..0000000 --- a/.php-cs-fixer.cache +++ /dev/null @@ -1 +0,0 @@ -{"php":"8.3.6","version":"3.59.3","indent":" ","lineEnding":"\n","rules":{"align_multiline_comment":true,"array_syntax":{"syntax":"short"},"backtick_to_shell_exec":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["return"]},"braces_position":{"allow_single_line_anonymous_functions":true,"allow_single_line_empty_anonymous_classes":true},"class_attributes_separation":{"elements":{"method":"one"}},"class_reference_name_casing":true,"clean_namespace":true,"concat_space":{"spacing":"one"},"declare_parentheses":true,"echo_tag_syntax":true,"empty_loop_body":{"style":"braces"},"empty_loop_condition":true,"fully_qualified_strict_types":true,"function_declaration":{"closure_function_spacing":"none"},"general_phpdoc_tag_rename":{"replacements":{"inheritDocs":"inheritDoc"}},"global_namespace_import":{"import_classes":false,"import_constants":false,"import_functions":false},"include":true,"increment_style":true,"integer_literal_case":true,"lambda_not_used_import":true,"linebreak_after_opening_tag":true,"magic_constant_casing":true,"magic_method_casing":true,"method_argument_space":{"on_multiline":"ignore"},"native_function_casing":true,"native_type_declaration_casing":true,"no_alias_language_construct_call":true,"no_alternative_syntax":true,"no_binary_string":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["attribute","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","square_brace_block","switch","throw","use"]},"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_null_property_initialization":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"allow_hidden_params":true,"remove_inheritdoc":true},"no_trailing_comma_in_singleline":true,"no_unneeded_braces":{"namespaces":true},"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","others","return","switch_case","yield","yield_from"]},"no_unneeded_import_alias":true,"no_unset_cast":true,"no_unused_imports":true,"no_useless_concat_operator":true,"no_useless_nullsafe_operator":true,"no_whitespace_before_comma_in_array":true,"normalize_index_brace":true,"nullable_type_declaration":true,"nullable_type_declaration_for_default_null_value":true,"object_operator_without_whitespace":true,"operator_linebreak":{"only_booleans":true},"ordered_imports":true,"ordered_types":{"null_adjustment":"always_last","sort_algorithm":"none"},"php_unit_fqcn_annotation":true,"php_unit_method_casing":true,"phpdoc_align":{"align":"left"},"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_order":{"order":["param","return","throws"]},"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":{"groups":[["Annotation","NamedArgumentConstructor","Target"],["author","copyright","license"],["category","package","subpackage"],["property","property-read","property-write"],["deprecated","link","see","since"]]},"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_tag_type":{"tags":{"inheritDoc":"inline"}},"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_var_without_name":true,"semicolon_after_instruction":true,"simple_to_complex_string_variable":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_comment_spacing":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"single_space_around_construct":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"statement_indentation":{"stick_comment_to_next_continuous_control_statement":true},"switch_continue_to_break":true,"trailing_comma_in_multiline":true,"trim_array_spaces":true,"type_declaration_spaces":true,"types_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"yoda_style":true,"array_indentation":true,"cast_spaces":true,"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_parentheses":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"return_type_declaration":true,"short_scalar_cast":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_line_after_imports":true,"spaces_inside_parentheses":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"header_comment":{"header":"This file is part of Sulu.\n\n(c) Sulu GmbH\n\nThis source file is subject to the MIT license that is bundled\nwith this source code in the file LICENSE."}},"hashes":{"\/private\/var\/folders\/02\/38pv02ln53sf66jz76rj189m0000gn\/T\/PHP CS Fixertemp_folder415\/DependencyInjection\/Configuration.php":"fc7a93d87c407e10fcb2611bd689efe4","\/private\/var\/folders\/02\/38pv02ln53sf66jz76rj189m0000gn\/T\/PHP CS Fixertemp_folder121\/DependencyInjection\/Configuration.php":"fc7a93d87c407e10fcb2611bd689efe4","\/private\/var\/folders\/02\/38pv02ln53sf66jz76rj189m0000gn\/T\/PHP CS Fixertemp_folder1303\/DependencyInjection\/Configuration.php":"c3ce9e4dc7c15c60b05bed438bec7d8f","\/private\/var\/folders\/02\/38pv02ln53sf66jz76rj189m0000gn\/T\/PHP CS Fixertemp_folder598\/DependencyInjection\/Configuration.php":"c3ce9e4dc7c15c60b05bed438bec7d8f"}} \ No newline at end of file From cb3d56c56aafd3ac6941a5e8240e01fb8351a45b Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Fri, 19 Jul 2024 09:13:55 +0200 Subject: [PATCH 07/18] Fix Typo in Composer.json --- composer.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index e7398b3..863c95b 100644 --- a/composer.json +++ b/composer.json @@ -7,18 +7,18 @@ "php": "^7.2 || ^8.0", "sulu/sulu": "^2.2.5 || ^2.3@dev", "ramsey/uuid": "^3.1 || ^4.0", - "symfony/dependency-injection": "^4.3 || ^5.0 || ^6.0 || ^6.0", - "symfony/config": "^4.3 || ^5.0 || ^6.0 || ^6.0", - "symfony/console": "^4.3 || ^5.0 || ^6.0 || ^6.0", - "symfony/http-foundation": "^4.3 || ^5.0 || ^6.0 || ^6.0", + "symfony/dependency-injection": "^4.3 || ^5.0 || ^6.0 || ^7.0", + "symfony/config": "^4.3 || ^5.0 || ^6.0 || ^7.0", + "symfony/console": "^4.3 || ^5.0 || ^6.0 || ^7.0", + "symfony/http-foundation": "^4.3 || ^5.0 || ^6.0 || ^7.0", "handcraftedinthealps/rest-routing-bundle": "^1.0", "friendsofsymfony/rest-bundle": "^2.8 || ^3.0", "jms/serializer-bundle": "^3.0 || ^4.0 || ^5.0", - "symfony/http-kernel": "^4.3 || ^5.0 || ^6.0 || ^6.0", + "symfony/http-kernel": "^4.3 || ^5.0 || ^6.0 || ^7.0", "doctrine/orm": "^2.5.3", - "symfony/event-dispatcher": "^4.3 || ^5.0 || ^6.0 || ^6.0", - "symfony/property-access": "^4.3 || ^5.0 || ^6.0 || ^6.0", - "symfony/routing": "^4.3 || ^5.0 || ^6.0 || ^6.0", + "symfony/event-dispatcher": "^4.3 || ^5.0 || ^6.0 || ^7.0", + "symfony/property-access": "^4.3 || ^5.0 || ^6.0 || ^7.0", + "symfony/routing": "^4.3 || ^5.0 || ^6.0 || ^7.0", "symfony-cmf/routing": "^2.1 || ^3.0" }, "require-dev": { @@ -30,12 +30,12 @@ "phpstan/phpstan-symfony": "^1.0", "phpunit/phpunit": "^8.0", "php-cs-fixer/shim": "^3.0", - "symfony/browser-kit": "^4.3 || ^5.0 || ^6.0 || ^6.0", - "symfony/dotenv": "^4.3 || ^5.0 || ^6.0 || ^6.0", + "symfony/browser-kit": "^4.3 || ^5.0 || ^6.0 || ^7.0", + "symfony/dotenv": "^4.3 || ^5.0 || ^6.0 || ^7.0", "symfony/monolog-bundle": "^3.1", - "jackalope/jackalope-doctrine-dbal": "^1.3.4", + "jackalope/jackalope-doctrine-dbal": "^1.3.4 || ^2.0", "handcraftedinthealps/zendsearch": "^2.0", - "symfony/framework-bundle": "^4.3 || ^5.0 || ^6.0 || ^6.0", + "symfony/framework-bundle": "^4.3 || ^5.0 || ^6.0 || ^7.0", "phpspec/prophecy": "^1.10" }, "keywords": [ From 05fb2f311cf84e82245ee047ea848fa8a8a7b849 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Fri, 19 Jul 2024 09:20:20 +0200 Subject: [PATCH 08/18] Update Command --- Command/ImportCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Command/ImportCommand.php b/Command/ImportCommand.php index fc6030f..3dff618 100644 --- a/Command/ImportCommand.php +++ b/Command/ImportCommand.php @@ -46,7 +46,7 @@ public function configure(): void ); } - public function execute(InputInterface $input, OutputInterface $output) + public function execute(InputInterface $input, OutputInterface $output): int { $progressBar = new ProgressBar($output); $progressBar->setFormat(' %current% [%bar%] %elapsed:6s% %memory:6s%'); From d661dad067da33ce9d3d81e8a4818010f95e4e5c Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Fri, 19 Jul 2024 09:26:23 +0200 Subject: [PATCH 09/18] Update Unittest --- Tests/Unit/Controller/RedirectControllerTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/Unit/Controller/RedirectControllerTest.php b/Tests/Unit/Controller/RedirectControllerTest.php index eb20eec..c17c979 100644 --- a/Tests/Unit/Controller/RedirectControllerTest.php +++ b/Tests/Unit/Controller/RedirectControllerTest.php @@ -14,7 +14,7 @@ use PHPUnit\Framework\TestCase; use Sulu\Bundle\RedirectBundle\Controller\WebsiteRedirectController; use Sulu\Bundle\RedirectBundle\Model\RedirectRouteInterface; -use Symfony\Component\HttpFoundation\ParameterBag; +use Symfony\Component\HttpFoundation\InputBag; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; @@ -31,7 +31,7 @@ class RedirectControllerTest extends TestCase private $request; /** - * @var ParameterBag + * @var InputBag */ private $queryBag; @@ -45,7 +45,7 @@ protected function setUp(): void $this->controller = new WebsiteRedirectController(); $this->request = $this->prophesize(Request::class); - $this->queryBag = $this->prophesize(ParameterBag::class); + $this->queryBag = $this->prophesize(InputBag::class); $this->redirectRoute = $this->prophesize(RedirectRouteInterface::class); $this->request->reveal()->query = $this->queryBag->reveal(); From 2913a73c043719b10816a89974d70fa0c3c8d17d Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Fri, 19 Jul 2024 09:34:50 +0200 Subject: [PATCH 10/18] Remove mocking from input Bag --- Tests/Unit/Controller/RedirectControllerTest.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Tests/Unit/Controller/RedirectControllerTest.php b/Tests/Unit/Controller/RedirectControllerTest.php index c17c979..92e1288 100644 --- a/Tests/Unit/Controller/RedirectControllerTest.php +++ b/Tests/Unit/Controller/RedirectControllerTest.php @@ -45,10 +45,10 @@ protected function setUp(): void $this->controller = new WebsiteRedirectController(); $this->request = $this->prophesize(Request::class); - $this->queryBag = $this->prophesize(InputBag::class); + $this->queryBag = new InputBag(); $this->redirectRoute = $this->prophesize(RedirectRouteInterface::class); - $this->request->reveal()->query = $this->queryBag->reveal(); + $this->request->reveal()->query = $this->queryBag; } public function testRedirect() @@ -56,8 +56,6 @@ public function testRedirect() $target = '/test'; $statusCode = 301; - $this->queryBag->all()->willReturn([]); - $this->redirectRoute->getTarget()->willReturn($target); $this->redirectRoute->getStatusCode()->willReturn($statusCode); @@ -74,7 +72,7 @@ public function testRedirectWithQuery() $statusCode = 301; $query = ['test' => 1, 'my-parameter' => 'awesome sulu']; - $this->queryBag->all()->willReturn($query); + $this->queryBag->add($query); $this->redirectRoute->getTarget()->willReturn($target); $this->redirectRoute->getStatusCode()->willReturn($statusCode); @@ -94,8 +92,6 @@ public function testRedirectExternal() $target = 'http://captain-sulu.io/test'; $statusCode = 301; - $this->queryBag->all()->willReturn([]); - $this->redirectRoute->getTarget()->willReturn($target); $this->redirectRoute->getStatusCode()->willReturn($statusCode); @@ -115,7 +111,7 @@ public function testRedirectExternalWithQuery() $statusCode = 301; $query = ['test' => 1, 'my-parameter' => 'awesome sulu']; - $this->queryBag->all()->willReturn($query); + $this->queryBag->add($query); $this->redirectRoute->getTarget()->willReturn($target); $this->redirectRoute->getStatusCode()->willReturn($statusCode); From 5d783fcfb550139b11c16100cb49725ce29c4665 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 23 Jul 2024 13:02:46 +0200 Subject: [PATCH 11/18] Set Different bags for test --- Tests/Unit/Controller/RedirectControllerTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/Unit/Controller/RedirectControllerTest.php b/Tests/Unit/Controller/RedirectControllerTest.php index 92e1288..3119fe6 100644 --- a/Tests/Unit/Controller/RedirectControllerTest.php +++ b/Tests/Unit/Controller/RedirectControllerTest.php @@ -15,6 +15,7 @@ use Sulu\Bundle\RedirectBundle\Controller\WebsiteRedirectController; use Sulu\Bundle\RedirectBundle\Model\RedirectRouteInterface; use Symfony\Component\HttpFoundation\InputBag; +use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; @@ -45,7 +46,7 @@ protected function setUp(): void $this->controller = new WebsiteRedirectController(); $this->request = $this->prophesize(Request::class); - $this->queryBag = new InputBag(); + $this->queryBag = class_exists(InputBag::class) ? new InputBag() : new ParameterBag(); $this->redirectRoute = $this->prophesize(RedirectRouteInterface::class); $this->request->reveal()->query = $this->queryBag; From fbb26b365850a4a5e4d5d70eaf751c0b7fb717c6 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 23 Jul 2024 13:13:06 +0200 Subject: [PATCH 12/18] Change @var parameter --- Tests/Unit/Controller/RedirectControllerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Unit/Controller/RedirectControllerTest.php b/Tests/Unit/Controller/RedirectControllerTest.php index 3119fe6..0e47b1c 100644 --- a/Tests/Unit/Controller/RedirectControllerTest.php +++ b/Tests/Unit/Controller/RedirectControllerTest.php @@ -32,7 +32,7 @@ class RedirectControllerTest extends TestCase private $request; /** - * @var InputBag + * @var InputBag|ParameterBag */ private $queryBag; From 12e05b52e2878ebb80ce8998598433e49df5dc4e Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 23 Jul 2024 13:30:02 +0200 Subject: [PATCH 13/18] Remove Baseline row --- phpstan-baseline.neon | 5 ----- 1 file changed, 5 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 389b837..bff652a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -360,11 +360,6 @@ parameters: count: 1 path: Tests/Unit/Controller/RedirectControllerTest.php - - - message: "#^Property Sulu\\\\Bundle\\\\RedirectBundle\\\\Tests\\\\Unit\\\\Controller\\\\RedirectControllerTest\\:\\:\\$queryBag \\(Symfony\\\\Component\\\\HttpFoundation\\\\ParameterBag\\) does not accept Prophecy\\\\Prophecy\\\\ObjectProphecy\\\\.$#" - count: 1 - path: Tests/Unit/Controller/RedirectControllerTest.php - - message: "#^Property Sulu\\\\Bundle\\\\RedirectBundle\\\\Tests\\\\Unit\\\\Controller\\\\RedirectControllerTest\\:\\:\\$redirectRoute \\(Sulu\\\\Bundle\\\\RedirectBundle\\\\Model\\\\RedirectRouteInterface\\) does not accept Prophecy\\\\Prophecy\\\\ObjectProphecy\\\\.$#" count: 1 From b537a50f7fc27ee9f3775578f7fb04a337444d3e Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 23 Jul 2024 13:33:07 +0200 Subject: [PATCH 14/18] baseline --- phpstan-baseline.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index bff652a..bbe7b21 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -327,7 +327,7 @@ parameters: - message: "#^Cannot call method willReturn\\(\\) on array\\.$#" - count: 4 + count: 3 path: Tests/Unit/Controller/RedirectControllerTest.php - From 47760b2fd52518aa623b3d0e9475deafe9f0b9a8 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 23 Jul 2024 13:37:10 +0200 Subject: [PATCH 15/18] test --- phpstan-baseline.neon | 4 ---- 1 file changed, 4 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index bbe7b21..42b0312 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -325,10 +325,6 @@ parameters: count: 4 path: Tests/Unit/Controller/RedirectControllerTest.php - - - message: "#^Cannot call method willReturn\\(\\) on array\\.$#" - count: 3 - path: Tests/Unit/Controller/RedirectControllerTest.php - message: "#^Cannot call method willReturn\\(\\) on int\\.$#" From 7ebe48f5683c05c9c862e0e34b6d3c861981c076 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 23 Jul 2024 13:42:23 +0200 Subject: [PATCH 16/18] set preremove event --- Resources/config/gone_subscriber.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/config/gone_subscriber.xml b/Resources/config/gone_subscriber.xml index 7f8dce8..24bbebd 100644 --- a/Resources/config/gone_subscriber.xml +++ b/Resources/config/gone_subscriber.xml @@ -19,7 +19,7 @@ class="Sulu\Bundle\RedirectBundle\GoneSubscriber\GoneEntitySubscriber"> - + From 4c71b3716aaa1ca029a973d103c2f8565ff4a0f7 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 23 Jul 2024 16:16:00 +0200 Subject: [PATCH 17/18] Refactor Request Mock --- .../Controller/RedirectControllerTest.php | 28 +++++++++++-------- phpstan-baseline.neon | 13 +-------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/Tests/Unit/Controller/RedirectControllerTest.php b/Tests/Unit/Controller/RedirectControllerTest.php index 0e47b1c..7db60bb 100644 --- a/Tests/Unit/Controller/RedirectControllerTest.php +++ b/Tests/Unit/Controller/RedirectControllerTest.php @@ -26,11 +26,6 @@ class RedirectControllerTest extends TestCase */ private $controller; - /** - * @var Request - */ - private $request; - /** * @var InputBag|ParameterBag */ @@ -45,11 +40,8 @@ protected function setUp(): void { $this->controller = new WebsiteRedirectController(); - $this->request = $this->prophesize(Request::class); $this->queryBag = class_exists(InputBag::class) ? new InputBag() : new ParameterBag(); $this->redirectRoute = $this->prophesize(RedirectRouteInterface::class); - - $this->request->reveal()->query = $this->queryBag; } public function testRedirect() @@ -57,10 +49,13 @@ public function testRedirect() $target = '/test'; $statusCode = 301; + $request = Request::create($target); + $request->query = $this->queryBag; + $this->redirectRoute->getTarget()->willReturn($target); $this->redirectRoute->getStatusCode()->willReturn($statusCode); - $response = $this->controller->redirect($this->request->reveal(), $this->redirectRoute->reveal()); + $response = $this->controller->redirect($request, $this->redirectRoute->reveal()); $this->assertInstanceOf(RedirectResponse::class, $response); $this->assertEquals($target, $response->getTargetUrl()); @@ -75,10 +70,13 @@ public function testRedirectWithQuery() $this->queryBag->add($query); + $request = Request::create($target); + $request->query = $this->queryBag; + $this->redirectRoute->getTarget()->willReturn($target); $this->redirectRoute->getStatusCode()->willReturn($statusCode); - $response = $this->controller->redirect($this->request->reveal(), $this->redirectRoute->reveal()); + $response = $this->controller->redirect($request, $this->redirectRoute->reveal()); $this->assertInstanceOf(RedirectResponse::class, $response); $this->assertEquals( @@ -93,10 +91,13 @@ public function testRedirectExternal() $target = 'http://captain-sulu.io/test'; $statusCode = 301; + $request = Request::create($target); + $request->query = $this->queryBag; + $this->redirectRoute->getTarget()->willReturn($target); $this->redirectRoute->getStatusCode()->willReturn($statusCode); - $response = $this->controller->redirect($this->request->reveal(), $this->redirectRoute->reveal()); + $response = $this->controller->redirect($request, $this->redirectRoute->reveal()); $this->assertInstanceOf(RedirectResponse::class, $response); $this->assertEquals( @@ -114,10 +115,13 @@ public function testRedirectExternalWithQuery() $this->queryBag->add($query); + $request = Request::create($target); + $request->query = $this->queryBag; + $this->redirectRoute->getTarget()->willReturn($target); $this->redirectRoute->getStatusCode()->willReturn($statusCode); - $response = $this->controller->redirect($this->request->reveal(), $this->redirectRoute->reveal()); + $response = $this->controller->redirect($request, $this->redirectRoute->reveal()); $this->assertInstanceOf(RedirectResponse::class, $response); $this->assertEquals( diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 42b0312..bbf9529 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -320,12 +320,6 @@ parameters: count: 4 path: Tests/Unit/Controller/RedirectControllerTest.php - - - message: "#^Call to an undefined method Symfony\\\\Component\\\\HttpFoundation\\\\Request\\:\\:reveal\\(\\)\\.$#" - count: 4 - path: Tests/Unit/Controller/RedirectControllerTest.php - - - message: "#^Cannot call method willReturn\\(\\) on int\\.$#" count: 4 @@ -361,14 +355,9 @@ parameters: count: 1 path: Tests/Unit/Controller/RedirectControllerTest.php - - - message: "#^Property Sulu\\\\Bundle\\\\RedirectBundle\\\\Tests\\\\Unit\\\\Controller\\\\RedirectControllerTest\\:\\:\\$request \\(Symfony\\\\Component\\\\HttpFoundation\\\\Request\\) does not accept Prophecy\\\\Prophecy\\\\ObjectProphecy\\\\.$#" - count: 1 - path: Tests/Unit/Controller/RedirectControllerTest.php - - message: "#^Property Symfony\\\\Component\\\\HttpFoundation\\\\Request\\:\\:\\$query \\(Symfony\\\\Component\\\\HttpFoundation\\\\InputBag\\\\) does not accept Symfony\\\\Component\\\\HttpFoundation\\\\ParameterBag\\.$#" - count: 1 + count: 4 path: Tests/Unit/Controller/RedirectControllerTest.php - From 77d0ac552f14e9dbe35b7d00fe3103c301e63a52 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 23 Jul 2024 16:48:02 +0200 Subject: [PATCH 18/18] Refactor Tests --- .../Controller/RedirectControllerTest.php | 29 +++++-------------- phpstan-baseline.neon | 5 ---- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/Tests/Unit/Controller/RedirectControllerTest.php b/Tests/Unit/Controller/RedirectControllerTest.php index 7db60bb..31f4302 100644 --- a/Tests/Unit/Controller/RedirectControllerTest.php +++ b/Tests/Unit/Controller/RedirectControllerTest.php @@ -14,8 +14,6 @@ use PHPUnit\Framework\TestCase; use Sulu\Bundle\RedirectBundle\Controller\WebsiteRedirectController; use Sulu\Bundle\RedirectBundle\Model\RedirectRouteInterface; -use Symfony\Component\HttpFoundation\InputBag; -use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; @@ -26,11 +24,6 @@ class RedirectControllerTest extends TestCase */ private $controller; - /** - * @var InputBag|ParameterBag - */ - private $queryBag; - /** * @var RedirectRouteInterface */ @@ -39,8 +32,6 @@ class RedirectControllerTest extends TestCase protected function setUp(): void { $this->controller = new WebsiteRedirectController(); - - $this->queryBag = class_exists(InputBag::class) ? new InputBag() : new ParameterBag(); $this->redirectRoute = $this->prophesize(RedirectRouteInterface::class); } @@ -49,8 +40,7 @@ public function testRedirect() $target = '/test'; $statusCode = 301; - $request = Request::create($target); - $request->query = $this->queryBag; + $request = Request::create('http://captain-sulu.io/'); $this->redirectRoute->getTarget()->willReturn($target); $this->redirectRoute->getStatusCode()->willReturn($statusCode); @@ -68,10 +58,9 @@ public function testRedirectWithQuery() $statusCode = 301; $query = ['test' => 1, 'my-parameter' => 'awesome sulu']; - $this->queryBag->add($query); - - $request = Request::create($target); - $request->query = $this->queryBag; + $request = Request::create('http://captain-sulu.io/'); + $request->query->set('test', $query['test']); + $request->query->set('my-parameter', $query['my-parameter']); $this->redirectRoute->getTarget()->willReturn($target); $this->redirectRoute->getStatusCode()->willReturn($statusCode); @@ -91,8 +80,7 @@ public function testRedirectExternal() $target = 'http://captain-sulu.io/test'; $statusCode = 301; - $request = Request::create($target); - $request->query = $this->queryBag; + $request = Request::create('http://captain-sulu.io/'); $this->redirectRoute->getTarget()->willReturn($target); $this->redirectRoute->getStatusCode()->willReturn($statusCode); @@ -113,10 +101,9 @@ public function testRedirectExternalWithQuery() $statusCode = 301; $query = ['test' => 1, 'my-parameter' => 'awesome sulu']; - $this->queryBag->add($query); - - $request = Request::create($target); - $request->query = $this->queryBag; + $request = Request::create('http://captain-sulu.io/'); + $request->query->set('test', $query['test']); + $request->query->set('my-parameter', $query['my-parameter']); $this->redirectRoute->getTarget()->willReturn($target); $this->redirectRoute->getStatusCode()->willReturn($statusCode); diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index bbf9529..2e4b222 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -355,11 +355,6 @@ parameters: count: 1 path: Tests/Unit/Controller/RedirectControllerTest.php - - - message: "#^Property Symfony\\\\Component\\\\HttpFoundation\\\\Request\\:\\:\\$query \\(Symfony\\\\Component\\\\HttpFoundation\\\\InputBag\\\\) does not accept Symfony\\\\Component\\\\HttpFoundation\\\\ParameterBag\\.$#" - count: 4 - path: Tests/Unit/Controller/RedirectControllerTest.php - - message: "#^Cannot access offset 'exceptions' on mixed\\.$#" count: 2