Skip to content

Commit

Permalink
Merge pull request #4978 from samsonasik/apply-rector-remove-duplicat…
Browse files Browse the repository at this point in the history
…ed-array-key

[Rector] Apply Rector: RemoveDuplicatedArrayKeyRector
  • Loading branch information
samsonasik authored Aug 1, 2021
2 parents cb4fe4d + cba2328 commit 4169dce
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 26 deletions.
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\Core\Configuration\Option;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DeadCode\Rector\Array_\RemoveDuplicatedArrayKeyRector;
use Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector;
use Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector;
use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector;
Expand Down Expand Up @@ -113,4 +114,5 @@
$services->set(RemoveUnusedVariableAssignRector::class);
$services->set(FuncGetArgsToVariadicParamRector::class);
$services->set(MakeInheritedMethodVisibilitySameAsParentRector::class);
$services->set(RemoveDuplicatedArrayKeyRector::class);
};
35 changes: 19 additions & 16 deletions tests/system/Helpers/InflectorHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,25 +241,28 @@ public function testDasherize()
}
}

public function testOrdinal()
public function provideOrdinal()
{
$suffixes = [
'st' => 1,
'nd' => 2,
'rd' => 3,
'th' => 4,
'th' => 11,
'th' => 20,
'st' => 21,
'nd' => 22,
'rd' => 23,
'th' => 24,
return [
['st', 1],
['nd', 2],
['rd', 3],
['th', 4],
['th', 11],
['th', 20],
['st', 21],
['nd', 22],
['rd', 23],
['th', 24],
];
}

foreach ($suffixes as $suffix => $number) {
$ordinal = ordinal($number);
$this->assertSame($suffix, $ordinal);
}
/**
* @dataProvider provideOrdinal
*/
public function testOrdinal(string $suffix, int $number)
{
$this->assertSame($suffix, ordinal($number));
}

public function testOrdinalize()
Expand Down
20 changes: 10 additions & 10 deletions tests/system/Validation/CreditCardRulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,42 +148,42 @@ public function creditCardProvider()
'6011 0009 9013 9424',
true,
],
'jcb1' => [
'jcb8' => [
'jcb',
'3530 1113 3330 0000',
true,
],
'jcb2' => [
'jcb9' => [
'jcb',
'3566 0020 2036 0505',
true,
],
'mastercard1' => [
'mastercard12' => [
'mastercard',
'5555 5555 5555 4444',
true,
],
'mastercard2' => [
'mastercard13' => [
'mastercard',
'5105 1051 0510 5100',
true,
],
'visa1' => [
'visa4' => [
'visa',
'4111 1111 1111 1111',
true,
],
'visa2' => [
'visa5' => [
'visa',
'4012 8888 8888 1881',
true,
],
'visa3' => [
'visa6' => [
'visa',
'4222 2222 2222 2',
true,
],
'dankort1' => [
'dankort5' => [
'dankort',
'5019 7170 1010 3742',
true,
Expand Down Expand Up @@ -1203,12 +1203,12 @@ public function creditCardProvider()
$this->generateCardNum(500, 16),
true,
],
'hsbc' => [
'hsbc1' => [
'hsbc',
$this->generateCardNum(56, 16),
true,
],
'hsbc' => [
'hsbc2' => [
'hsbc',
$this->generateCardNum(57, 16),
false,
Expand Down

0 comments on commit 4169dce

Please sign in to comment.