Skip to content

[Rector] Apply Rector: RemoveDuplicatedArrayKeyRector#4978

Merged
samsonasik merged 5 commits intocodeigniter4:developfrom
samsonasik:apply-rector-remove-duplicated-array-key
Aug 1, 2021
Merged

[Rector] Apply Rector: RemoveDuplicatedArrayKeyRector#4978
samsonasik merged 5 commits intocodeigniter4:developfrom
samsonasik:apply-rector-remove-duplicated-array-key

Conversation

@samsonasik
Copy link
Copy Markdown
Member

Remove duplicated key in defined arrays with RemoveDuplicatedArrayKeyRector rector rule.

Checklist:

  • Securely signed commits

Comment thread tests/system/Validation/CreditCardRulesTest.php
Comment thread tests/system/Validation/CreditCardRulesTest.php
Comment thread tests/system/Helpers/InflectorHelperTest.php
@samsonasik samsonasik requested a review from paulbalandan July 29, 2021 03:23
Comment thread tests/system/Helpers/InflectorHelperTest.php Outdated
Co-authored-by: John Paul E. Balandan, CPA <51850998+paulbalandan@users.noreply.github.com>
Copy link
Copy Markdown
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The array keys on the provider in CreditCardRulesTest.php should stay. These are used to name data sets during test failure. (e.g. "testValidCCNumber failed with data set 'not_numierc'") and make it easier to track down the actual failure - otherwise it enumerates all the data from the provider which can make for a messy output.

@samsonasik
Copy link
Copy Markdown
Member Author

samsonasik commented Jul 29, 2021

@MGatner when the key are same, only last that used, do you think that should be named indexed, eg: hsbc1, etc

            'hsbc' => [
                 'hsbc',
                 $this->generateCardNum(56, 16),
                 true,
             ],
-             'hsbc' => [
+             'hsbc1' => [
                 'hsbc',
                 $this->generateCardNum(57, 16),

@MGatner
Copy link
Copy Markdown
Member

MGatner commented Jul 31, 2021

Yes

@samsonasik
Copy link
Copy Markdown
Member Author

@MGatner implemented

@samsonasik samsonasik requested a review from MGatner July 31, 2021 13:49
@samsonasik
Copy link
Copy Markdown
Member Author

@MGatner I am merging it

@samsonasik samsonasik merged commit 4169dce into codeigniter4:develop Aug 1, 2021
@samsonasik samsonasik deleted the apply-rector-remove-duplicated-array-key branch August 1, 2021 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants