From 28c180abb6d8dbb8c341d388af8777a9036f16f7 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 07:25:14 +0000 Subject: [PATCH 01/13] feat: Updated src/StringManipulation.php --- src/StringManipulation.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/StringManipulation.php b/src/StringManipulation.php index bbbf2ea..de7c8e8 100644 --- a/src/StringManipulation.php +++ b/src/StringManipulation.php @@ -10,21 +10,21 @@ /** * Class StringManipulation. * - * This class provides a collection of static methods for various string operations. - * These operations include, but are not limited to: - * - String transformation: Changing the format or structure of a string. - * - Accent removal: Removing accents from characters within a string. - * - String replacement: Replacing certain substrings within a string with other substrings. - * - Date validation: Checking if a given date string is valid according to a specified format. + * This class offers a comprehensive suite of static methods for a variety of string operations, + * making it an indispensable resource for tasks involving string manipulation or validation. + * The operations encompass, but are not limited to: + * - String transformation: Modifying the format or structure of a string. + * - Accent removal: Eliminating accents from characters within a string. + * - String replacement: Substituting specific substrings within a string with alternative substrings. + * - Date validation: Verifying the validity of a given date string against a specified format. * - * Each method in this class is designed to perform a specific operation and can be used independently of the others. - * This makes the class a versatile tool for any tasks involving string manipulation or validation. + * Each method within this class is meticulously crafted to execute a distinct operation, + * allowing for their independent utilisation. This attribute renders the class a versatile + * tool for any string manipulation or validation endeavours. * - * Note: This class is suppressed from UnusedClass warning from Psalm static analysis tool. - * It means that - * the class is not directly instantiated or invoked in the codebase. - * However, it is intended to be used - * wherever necessary, hence the suppression. + * Note: This class is exempt from the UnusedClass warning by the Psalm static analysis tool, + * indicating that while it may not be directly instantiated or invoked within the codebase, + * it is designed for use wherever necessary, thus justifying the exemption. * * @psalm-suppress UnusedClass */ From 49ad307a6e89b2ba8c835024e61b5241bd6f2bc5 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 07:28:48 +0000 Subject: [PATCH 02/13] feat: Updated src/StringManipulation.php --- src/StringManipulation.php | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/StringManipulation.php b/src/StringManipulation.php index de7c8e8..d3dfdb2 100644 --- a/src/StringManipulation.php +++ b/src/StringManipulation.php @@ -236,26 +236,22 @@ public static function removeAccents(string $str): string /** - * Replace all occurrences of the search string(s) with the corresponding replacement string(s) in the subject. + * Replaces all occurrences of the search string(s) with the corresponding replacement string(s) in the subject. * - * This function is a stricter version of the built-in PHP str_replace function. It takes three parameters: - * - $search: The value(s) being searched for in the subject. This can be a single string or an array of strings. - * - $replace: The replacement value(s) to replace found search values. This can be a single string or an array of - * strings. - * - $subject: The string being searched and replaced on. + * This method acts as a more precise version of the built-in PHP str_replace function. It accepts three parameters: + * - $search: The value(s) being searched for within the subject. This can be either a single string or an array of strings. + * - $replace: The replacement value(s) for the found search values. This can also be either a single string or an array of strings. + * - $subject: The string within which the search and replacement is to be performed. * - * The function returns a new string where all occurrences of each search value have been replaced by the - * corresponding replacement value. + * It returns a new string wherein every occurrence of each search value has been substituted with the corresponding replacement value. * - * This function is useful when you need to replace multiple different substrings within a string, or when you need - * to perform the same set of replacements on multiple strings. + * This method is particularly useful for replacing multiple distinct substrings within a string, or when the same set of replacements needs to be applied across multiple strings. * - * @param string|string[] $search The value(s) being searched for in the subject. - * @param string|string[] $replace The replacement value(s) to replace found search values. - * @param string $subject The string being searched and replaced on. + * @param string|string[] $search The value(s) being searched for within the subject. + * @param string|string[] $replace The replacement value(s) for the found search values. + * @param string $subject The string within which the search and replacement is to be performed. * - * @return string Returns a string where all occurrences of each search value have been replaced by the - * corresponding replacement value. + * @return string A string where every occurrence of each search value has been substituted with the corresponding replacement value. * * @psalm-suppress PossiblyUnusedMethod,UnusedParam */ From 01005683476a831a97c1c56fc766994ce0dd6ae1 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 07:31:35 +0000 Subject: [PATCH 03/13] feat: Updated src/StringManipulation.php --- src/StringManipulation.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/StringManipulation.php b/src/StringManipulation.php index d3dfdb2..3471e1b 100644 --- a/src/StringManipulation.php +++ b/src/StringManipulation.php @@ -11,7 +11,7 @@ * Class StringManipulation. * * This class offers a comprehensive suite of static methods for a variety of string operations, - * making it an indispensable resource for tasks involving string manipulation or validation. + * making it an indispensable resource for tasks involving string manipulation or validation. Utilising a blend of advanced algorithms and efficient coding practices,Utilising a blend of advanced algorithms and efficient coding practices, * The operations encompass, but are not limited to: * - String transformation: Modifying the format or structure of a string. * - Accent removal: Eliminating accents from characters within a string. @@ -40,7 +40,7 @@ class StringManipulation * This function performs several transformations on the input string to make it suitable for * searching within a database. The transformations include: * - Applying the name fixing standards via the `nameFix` function. (Refer to its PHPDoc for details.) - * - Converting the string to lowercase. + * - Converting the string to lower case. * - Replacing various special characters with spaces (e.g., '{', '}', '(', ')', etc.). * - Replacing underscores with spaces. * - Removing accents from characters. @@ -249,7 +249,7 @@ public static function removeAccents(string $str): string * * @param string|string[] $search The value(s) being searched for within the subject. * @param string|string[] $replace The replacement value(s) for the found search values. - * @param string $subject The string within which the search and replacement is to be performed. + * @param string $subject The string within which the search and replacement are to be performed. * * @return string A string where every occurrence of each search value has been substituted with the corresponding replacement value. * @@ -311,7 +311,7 @@ public static function isValidDate(string $date, string $format = 'Y-m-d H:i:s') * of characters as inputs. The function trims the specified characters from the beginning and end of the input * string. If no characters are specified, it trims whitespace characters by default. The characters that are * trimmed by default are: " " (ASCII 32 (0x20)), an ordinary space. - * "\t" (ASCII 9 (0x09)), a tab. + * "\t" (ASCII 9 (0x09)), a tabulation character. * "\n" (ASCII 10 (0x0A)), a new line (line feed). * "\r" (ASCII 13 (0x0D)), a carriage return. * "\0" (ASCII 0 (0x00)), the NUL-byte. From d2832cf294cb9f793431a1e9167d621dc689f462 Mon Sep 17 00:00:00 2001 From: Marjo van Lier Date: Mon, 26 Feb 2024 08:42:44 +0100 Subject: [PATCH 04/13] Improve readability of documentation in StringManipulation class The existing class and method documentation in the StringManipulation class has been reformatted for better readability. The previous documentation was modified to break down longer lines and improve overall readability. This change will aid developers in understanding the intended function and usage of this class and its methods. --- src/StringManipulation.php | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/StringManipulation.php b/src/StringManipulation.php index 3471e1b..2a656a2 100644 --- a/src/StringManipulation.php +++ b/src/StringManipulation.php @@ -10,20 +10,21 @@ /** * Class StringManipulation. * - * This class offers a comprehensive suite of static methods for a variety of string operations, - * making it an indispensable resource for tasks involving string manipulation or validation. Utilising a blend of advanced algorithms and efficient coding practices,Utilising a blend of advanced algorithms and efficient coding practices, - * The operations encompass, but are not limited to: + * This class offers a comprehensive suite of static methods for a variety of string operations, + * making it an indispensable resource for tasks involving string manipulation or validation. Utilising a blend of + * advanced algorithms and efficient coding practices,Utilising a blend of advanced algorithms and efficient coding + * practices, The operations encompass, but are not limited to: * - String transformation: Modifying the format or structure of a string. * - Accent removal: Eliminating accents from characters within a string. * - String replacement: Substituting specific substrings within a string with alternative substrings. * - Date validation: Verifying the validity of a given date string against a specified format. * - * Each method within this class is meticulously crafted to execute a distinct operation, - * allowing for their independent utilisation. This attribute renders the class a versatile + * Each method within this class is meticulously crafted to execute a distinct operation, + * allowing for their independent utilisation. This attribute renders the class a versatile * tool for any string manipulation or validation endeavours. * - * Note: This class is exempt from the UnusedClass warning by the Psalm static analysis tool, - * indicating that while it may not be directly instantiated or invoked within the codebase, + * Note: This class is exempt from the UnusedClass warning by the Psalm static analysis tool, + * indicating that while it may not be directly instantiated or invoked within the codebase, * it is designed for use wherever necessary, thus justifying the exemption. * * @psalm-suppress UnusedClass @@ -238,20 +239,26 @@ public static function removeAccents(string $str): string /** * Replaces all occurrences of the search string(s) with the corresponding replacement string(s) in the subject. * - * This method acts as a more precise version of the built-in PHP str_replace function. It accepts three parameters: - * - $search: The value(s) being searched for within the subject. This can be either a single string or an array of strings. - * - $replace: The replacement value(s) for the found search values. This can also be either a single string or an array of strings. + * This method acts as a more precise version of the built-in PHP str_replace function. It accepts three + * parameters: + * - $search: The value(s) being searched for within the subject. This can be either a single string or an array of + * strings. + * - $replace: The replacement value(s) for the found search values. This can also be either a single string or an + * array of strings. * - $subject: The string within which the search and replacement is to be performed. * - * It returns a new string wherein every occurrence of each search value has been substituted with the corresponding replacement value. + * It returns a new string wherein every occurrence of each search value has been substituted with the + * corresponding replacement value. * - * This method is particularly useful for replacing multiple distinct substrings within a string, or when the same set of replacements needs to be applied across multiple strings. + * This method is particularly useful for replacing multiple distinct substrings within a string, or when the same + * set of replacements needs to be applied across multiple strings. * * @param string|string[] $search The value(s) being searched for within the subject. * @param string|string[] $replace The replacement value(s) for the found search values. * @param string $subject The string within which the search and replacement are to be performed. * - * @return string A string where every occurrence of each search value has been substituted with the corresponding replacement value. + * @return string A string where every occurrence of each search value has been substituted with the corresponding + * replacement value. * * @psalm-suppress PossiblyUnusedMethod,UnusedParam */ From b3c725aebd6ce441e4d01d3321e36114255e424a Mon Sep 17 00:00:00 2001 From: Marjo van Lier Date: Mon, 26 Feb 2024 08:49:24 +0100 Subject: [PATCH 05/13] Consolidate comment in StringManipulation class Duplication of the phrase "Utilising a blend of advanced algorithms and efficient coding practices," was observed in the in-code documentation of the StringManipulation class. This redundancy has been removed to improve readability and maintain concise documentation standards. --- src/StringManipulation.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/StringManipulation.php b/src/StringManipulation.php index 2a656a2..ef37d86 100644 --- a/src/StringManipulation.php +++ b/src/StringManipulation.php @@ -12,8 +12,7 @@ * * This class offers a comprehensive suite of static methods for a variety of string operations, * making it an indispensable resource for tasks involving string manipulation or validation. Utilising a blend of - * advanced algorithms and efficient coding practices,Utilising a blend of advanced algorithms and efficient coding - * practices, The operations encompass, but are not limited to: + * advanced algorithms and efficient coding practices, The operations encompass, but are not limited to: * - String transformation: Modifying the format or structure of a string. * - Accent removal: Eliminating accents from characters within a string. * - String replacement: Substituting specific substrings within a string with alternative substrings. From 8ef6b5c6425058d9f4ff876a9b62ddc18d47b4a5 Mon Sep 17 00:00:00 2001 From: Marjo van Lier Date: Mon, 26 Feb 2024 08:50:33 +0100 Subject: [PATCH 06/13] Improve $search and $replace parameter descriptions. The descriptions for parameters $search and $replace were modified to explicitly state that they can take both single strings and arrays of strings. This clarification enhances the accuracy of the function's documentation. --- src/StringManipulation.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/StringManipulation.php b/src/StringManipulation.php index ef37d86..8c8f103 100644 --- a/src/StringManipulation.php +++ b/src/StringManipulation.php @@ -240,9 +240,9 @@ public static function removeAccents(string $str): string * * This method acts as a more precise version of the built-in PHP str_replace function. It accepts three * parameters: - * - $search: The value(s) being searched for within the subject. This can be either a single string or an array of - * strings. - * - $replace: The replacement value(s) for the found search values. This can also be either a single string or an + * - $search: $search: The value(s) being searched for within the subject. This can be a single string or an array + * of strings. + * - $replace: $replace: The replacement value(s) for the found search values. This can be a single string or an * array of strings. * - $subject: The string within which the search and replacement is to be performed. * From cbfc7796b09f38610ccc7e7250692ed20fd12184 Mon Sep 17 00:00:00 2001 From: Marjo van Lier Date: Mon, 26 Feb 2024 08:59:20 +0100 Subject: [PATCH 07/13] Revise method description in StringManipulation.php Updated the term "tabulation character" to "tab" to enhance readability. This terminology change ensures consistency with the rest of the documentation. --- src/StringManipulation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StringManipulation.php b/src/StringManipulation.php index 8c8f103..027698d 100644 --- a/src/StringManipulation.php +++ b/src/StringManipulation.php @@ -317,7 +317,7 @@ public static function isValidDate(string $date, string $format = 'Y-m-d H:i:s') * of characters as inputs. The function trims the specified characters from the beginning and end of the input * string. If no characters are specified, it trims whitespace characters by default. The characters that are * trimmed by default are: " " (ASCII 32 (0x20)), an ordinary space. - * "\t" (ASCII 9 (0x09)), a tabulation character. + * "\t" (ASCII 9 (0x09)), a tab. * "\n" (ASCII 10 (0x0A)), a new line (line feed). * "\r" (ASCII 13 (0x0D)), a carriage return. * "\0" (ASCII 0 (0x00)), the NUL-byte. From 680980c4ae723a703cec6721ca1586438f899755 Mon Sep 17 00:00:00 2001 From: Marjo van Lier Date: Mon, 26 Feb 2024 09:00:56 +0100 Subject: [PATCH 08/13] Refine class description in StringManipulation.php Clarified the description of the StringManipulation class and rephrased the list of operations it includes. The update ensures a more succinct and clear definition of the class and the functions it performs, promoting ease of understanding for anyone referring to this code. --- src/StringManipulation.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/StringManipulation.php b/src/StringManipulation.php index 027698d..e93f738 100644 --- a/src/StringManipulation.php +++ b/src/StringManipulation.php @@ -12,7 +12,8 @@ * * This class offers a comprehensive suite of static methods for a variety of string operations, * making it an indispensable resource for tasks involving string manipulation or validation. Utilising a blend of - * advanced algorithms and efficient coding practices, The operations encompass, but are not limited to: + * advanced algorithms and efficient coding practices. + * Operations include: * - String transformation: Modifying the format or structure of a string. * - Accent removal: Eliminating accents from characters within a string. * - String replacement: Substituting specific substrings within a string with alternative substrings. From f2622c501a84d4109b50cc5aeca32ce6dc6f5b8e Mon Sep 17 00:00:00 2001 From: Marjo van Lier Date: Mon, 26 Feb 2024 09:04:32 +0100 Subject: [PATCH 09/13] Refine string conversion to lower case method The code has been updated to be more specific when converting a string to lower case. Instead of utilizing a generic conversion method, it now uses the `strtolower` function explicitly to accomplish this task. This change provides clarity about the exact function used for this transformation. --- src/StringManipulation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StringManipulation.php b/src/StringManipulation.php index e93f738..67288a4 100644 --- a/src/StringManipulation.php +++ b/src/StringManipulation.php @@ -41,7 +41,7 @@ class StringManipulation * This function performs several transformations on the input string to make it suitable for * searching within a database. The transformations include: * - Applying the name fixing standards via the `nameFix` function. (Refer to its PHPDoc for details.) - * - Converting the string to lower case. + * - Converting the string to lower case using `strtolower`. * - Replacing various special characters with spaces (e.g., '{', '}', '(', ')', etc.). * - Replacing underscores with spaces. * - Removing accents from characters. From 7efa3c42a7661e26ef25d613f3df01507cf43276 Mon Sep 17 00:00:00 2001 From: Marjo van Lier Date: Mon, 26 Feb 2024 09:05:50 +0100 Subject: [PATCH 10/13] Remove duplicate variable declarations in comments The comments in the StringManipulation.php file contained duplicate declarations of the $search and $replace variables. This commit removes the duplicate mentions, making the comments cleaner and easier to understand. --- src/StringManipulation.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/StringManipulation.php b/src/StringManipulation.php index 67288a4..75c1814 100644 --- a/src/StringManipulation.php +++ b/src/StringManipulation.php @@ -241,10 +241,10 @@ public static function removeAccents(string $str): string * * This method acts as a more precise version of the built-in PHP str_replace function. It accepts three * parameters: - * - $search: $search: The value(s) being searched for within the subject. This can be a single string or an array - * of strings. - * - $replace: $replace: The replacement value(s) for the found search values. This can be a single string or an - * array of strings. + * - $search: The value(s) being searched for within the subject. This can be a single string or an array of + * strings. + * - $replace: The replacement value(s) for the found search values. This can be a single string or an array of + * strings. * - $subject: The string within which the search and replacement is to be performed. * * It returns a new string wherein every occurrence of each search value has been substituted with the From c45f9dec27221710757fe58f3774012486a976dc Mon Sep 17 00:00:00 2001 From: Marjo van Lier Date: Mon, 26 Feb 2024 09:17:28 +0100 Subject: [PATCH 11/13] Update PR agent configurations Added and modified several configurations in the .pr_agent.toml file to improve code suggestion handling and review process. The changes include enabling extended mode for improvements, ranking code suggestions, and managing push triggers. The aim is to streamline the PR review procedure and enhance the code quality. --- .pr_agent.toml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.pr_agent.toml b/.pr_agent.toml index 8b2ba45..52b3d54 100644 --- a/.pr_agent.toml +++ b/.pr_agent.toml @@ -15,7 +15,11 @@ enable_auto_approval = true maximal_review_effort = 5 [pr_code_suggestions] +num_code_suggestions = 5 summarize = true +auto_extended_mode = true +rank_suggestions = true +enable_help_text = false [pr_update_changelog] push_changelog_changes=false @@ -29,13 +33,13 @@ auto_improve = true pr_commands = [ "/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true", "/update_changelog --pr_update_changelog.push_changelog_changes=false", - "/improve --pr_code_suggestions.summarize=true", + "/improve --extended --pr_code_suggestions.summarize=true", "/review auto_approve --pr_reviewer.num_code_suggestions=0 --pr_reviewer.inline_code_comments=true", ] push_commands = [ "/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true", "/update_changelog --pr_update_changelog.push_changelog_changes=false", - "/improve --pr_code_suggestions.summarize=true", + "/improve --extended --pr_code_suggestions.summarize=true", """/auto_review -i \ --pr_reviewer.require_focused_review=false \ --pr_reviewer.require_score_review=false \ @@ -51,3 +55,4 @@ push_commands = [ """, "/review auto_approve --pr_reviewer.num_code_suggestions=0 --pr_reviewer.inline_code_comments=true" ] +handle_push_trigger = true \ No newline at end of file From 671e061ea0b478a977e4f13e0724ed2b47bb79c3 Mon Sep 17 00:00:00 2001 From: Marjo van Lier Date: Mon, 26 Feb 2024 13:07:05 +0100 Subject: [PATCH 12/13] Update extra_instructions in .pr_agent.toml The 'extra_instructions' field in the PR agent configuration, .pr_agent.toml, has been updated. The new instructions ask PR reviewers explicitly to "Ensure comments are clear and relevant". This change encourages clearer communication and more relevant feedback during the review process. --- .pr_agent.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pr_agent.toml b/.pr_agent.toml index 52b3d54..6dcb8b4 100644 --- a/.pr_agent.toml +++ b/.pr_agent.toml @@ -4,7 +4,7 @@ ask_and_reflect = true automatic_review = true remove_previous_review_comment = true persistent_comment = true -extra_instructions = "" +extra_instructions = "Please ensure comments are clear and relevant." enable_review_labels_security = true enable_review_labels_effort = true require_all_thresholds_for_incremental_review = false @@ -22,7 +22,7 @@ rank_suggestions = true enable_help_text = false [pr_update_changelog] -push_changelog_changes=false +push_changelog_changes = false [github_action_config] auto_review = true From 07cffaf1e399e6800316210852590f788b2d4735 Mon Sep 17 00:00:00 2001 From: Marjo van Lier Date: Mon, 26 Feb 2024 13:10:02 +0100 Subject: [PATCH 13/13] Update instructions in PR agent config The extra instructions in the PR agent configuration file have been updated to request comments to be "concise and actionable" rather than just "clear and relevant". This is in an effort to improve the quality of feedback and make it more targeted and effective. --- .pr_agent.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pr_agent.toml b/.pr_agent.toml index 6dcb8b4..052592f 100644 --- a/.pr_agent.toml +++ b/.pr_agent.toml @@ -4,7 +4,7 @@ ask_and_reflect = true automatic_review = true remove_previous_review_comment = true persistent_comment = true -extra_instructions = "Please ensure comments are clear and relevant." +extra_instructions = "Please ensure comments are concise and actionable." enable_review_labels_security = true enable_review_labels_effort = true require_all_thresholds_for_incremental_review = false