]> git.agnieray.net Git - galette.git/blob - patches/0001-Fix-PHP-7.4-array-syntax.patch
Update faker, zend-i18n, add php 7.4 faker patch
[galette.git] / patches / 0001-Fix-PHP-7.4-array-syntax.patch
1 From a26b3e795b9fdc353a6e984a14dbbb1a35f93be5 Mon Sep 17 00:00:00 2001
2 From: Johan Cwiklinski <jcwiklinski@teclib.com>
3 Date: Sat, 19 Oct 2019 23:14:40 +0200
4 Subject: [PATCH] Fix PHP 7.4 array syntax
5
6 ---
7 src/Faker/Calculator/Luhn.php | 4 ++--
8 test/Faker/Provider/fi_FI/PersonTest.php | 4 ++--
9 test/Faker/Provider/sv_SE/PersonTest.php | 4 ++--
10 3 files changed, 6 insertions(+), 6 deletions(-)
11
12 diff --git a/src/Faker/Calculator/Luhn.php b/src/Faker/Calculator/Luhn.php
13 index c37c6c19..1cb71a16 100644
14 --- a/src/Faker/Calculator/Luhn.php
15 +++ b/src/Faker/Calculator/Luhn.php
16 @@ -24,10 +24,10 @@ class Luhn
17 $length = strlen($number);
18 $sum = 0;
19 for ($i = $length - 1; $i >= 0; $i -= 2) {
20 - $sum += $number{$i};
21 + $sum += $number[$i];
22 }
23 for ($i = $length - 2; $i >= 0; $i -= 2) {
24 - $sum += array_sum(str_split($number{$i} * 2));
25 + $sum += array_sum(str_split($number[$i] * 2));
26 }
27
28 return $sum % 10;
29 diff --git a/test/Faker/Provider/fi_FI/PersonTest.php b/test/Faker/Provider/fi_FI/PersonTest.php
30 index b979666e..3093178e 100644
31 --- a/test/Faker/Provider/fi_FI/PersonTest.php
32 +++ b/test/Faker/Provider/fi_FI/PersonTest.php
33 @@ -71,12 +71,12 @@ class PersonTest extends TestCase
34 public function testPersonalIdentityNumberGeneratesOddValuesForMales()
35 {
36 $pin = $this->faker->personalIdentityNumber(null, 'male');
37 - $this->assertEquals(1, $pin{9} % 2);
38 + $this->assertEquals(1, $pin[9] % 2);
39 }
40
41 public function testPersonalIdentityNumberGeneratesEvenValuesForFemales()
42 {
43 $pin = $this->faker->personalIdentityNumber(null, 'female');
44 - $this->assertEquals(0, $pin{9} % 2);
45 + $this->assertEquals(0, $pin[9] % 2);
46 }
47 }
48 diff --git a/test/Faker/Provider/sv_SE/PersonTest.php b/test/Faker/Provider/sv_SE/PersonTest.php
49 index 584998da..14e32467 100644
50 --- a/test/Faker/Provider/sv_SE/PersonTest.php
51 +++ b/test/Faker/Provider/sv_SE/PersonTest.php
52 @@ -50,12 +50,12 @@ class PersonTest extends TestCase
53 public function testPersonalIdentityNumberGeneratesOddValuesForMales()
54 {
55 $pin = $this->faker->personalIdentityNumber(null, 'male');
56 - $this->assertEquals(1, $pin{9} % 2);
57 + $this->assertEquals(1, $pin[9] % 2);
58 }
59
60 public function testPersonalIdentityNumberGeneratesEvenValuesForFemales()
61 {
62 $pin = $this->faker->personalIdentityNumber(null, 'female');
63 - $this->assertEquals(0, $pin{9} % 2);
64 + $this->assertEquals(0, $pin[9] % 2);
65 }
66 }
67 --
68 2.21.0
69