1
0
mirror of https://github.com/fzaninotto/Faker.git synced 2025-04-21 16:01:56 +02:00

Curly braces for arrays is deprecated in PHP 7.4 (detected by PHPCompatibility)

This commit is contained in:
wimg 2019-11-12 10:10:47 +09:00
parent 81b3400169
commit 1bf44386ea
No known key found for this signature in database
GPG Key ID: 9336596A6967B2A8
3 changed files with 6 additions and 6 deletions

View File

@ -24,10 +24,10 @@ class Luhn
$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;

View File

@ -71,12 +71,12 @@ class PersonTest extends TestCase
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);
}
}

View File

@ -50,12 +50,12 @@ class PersonTest extends TestCase
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);
}
}