Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1843 from wimg/php74compat-curly-braces
Browse files Browse the repository at this point in the history
Curly braces for arrays is deprecated in PHP 7.4
  • Loading branch information
localheinz authored Nov 23, 2019
2 parents a959610 + 1bf4438 commit c981c04
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Faker/Calculator/Luhn.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ private static function checksum($number)
$length = strlen($number);
$sum = 0;
for ($i = $length - 1; $i >= 0; $i -= 2) {
$sum += $number{$i};
$sum += $number[$i];
}
for ($i = $length - 2; $i >= 0; $i -= 2) {
$sum += array_sum(str_split($number{$i} * 2));
$sum += array_sum(str_split($number[$i] * 2));
}

return $sum % 10;
Expand Down
4 changes: 2 additions & 2 deletions test/Faker/Provider/fi_FI/PersonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ public function testPersonalIdentityNumberGeneratesCompliantNumbers()
public function testPersonalIdentityNumberGeneratesOddValuesForMales()
{
$pin = $this->faker->personalIdentityNumber(null, 'male');
$this->assertEquals(1, $pin{9} % 2);
$this->assertEquals(1, $pin[9] % 2);
}

public function testPersonalIdentityNumberGeneratesEvenValuesForFemales()
{
$pin = $this->faker->personalIdentityNumber(null, 'female');
$this->assertEquals(0, $pin{9} % 2);
$this->assertEquals(0, $pin[9] % 2);
}
}
4 changes: 2 additions & 2 deletions test/Faker/Provider/sv_SE/PersonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public function testPersonalIdentityNumberGeneratesLuhnCompliantNumbers()
public function testPersonalIdentityNumberGeneratesOddValuesForMales()
{
$pin = $this->faker->personalIdentityNumber(null, 'male');
$this->assertEquals(1, $pin{9} % 2);
$this->assertEquals(1, $pin[9] % 2);
}

public function testPersonalIdentityNumberGeneratesEvenValuesForFemales()
{
$pin = $this->faker->personalIdentityNumber(null, 'female');
$this->assertEquals(0, $pin{9} % 2);
$this->assertEquals(0, $pin[9] % 2);
}
}

0 comments on commit c981c04

Please sign in to comment.