Passed
Pull Request — main (#3854)
by Jonathan
07:38
created
app/Relationship.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public static function fixed(string $nominative, string $genitive): Relationship
83 83
     {
84
-        return new static(fn () => [$nominative, $genitive]);
84
+        return new static(fn() => [$nominative, $genitive]);
85 85
     }
86 86
 
87 87
     /**
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function adopted(): Relationship
128 128
     {
129
-        $this->matchers[] = fn (array $nodes): bool => count($nodes) > 2 && $nodes[2]
129
+        $this->matchers[] = fn(array $nodes): bool => count($nodes) > 2 && $nodes[2]
130 130
                 ->facts(['FAMC'], false, Auth::PRIV_HIDE)
131
-                ->contains(fn (Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'adopted');
131
+                ->contains(fn(Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'adopted');
132 132
 
133 133
         return $this;
134 134
     }
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public function adoptive(): Relationship
140 140
     {
141
-        $this->matchers[] = fn (array $nodes): bool => $nodes[0]
141
+        $this->matchers[] = fn(array $nodes): bool => $nodes[0]
142 142
             ->facts(['FAMC'], false, Auth::PRIV_HIDE)
143
-            ->contains(fn (Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'adopted');
143
+            ->contains(fn(Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'adopted');
144 144
 
145 145
         return $this;
146 146
     }
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
      */
347 347
     public function fostered(): Relationship
348 348
     {
349
-        $this->matchers[] = fn (array $nodes): bool => count($nodes) > 2 && $nodes[2]
349
+        $this->matchers[] = fn(array $nodes): bool => count($nodes) > 2 && $nodes[2]
350 350
                 ->facts(['FAMC'], false, Auth::PRIV_HIDE)
351
-                ->contains(fn (Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'foster');
351
+                ->contains(fn(Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'foster');
352 352
 
353 353
         return $this;
354 354
     }
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
      */
359 359
     public function fostering(): Relationship
360 360
     {
361
-        $this->matchers[] = fn (array $nodes): bool => $nodes[0]
361
+        $this->matchers[] = fn(array $nodes): bool => $nodes[0]
362 362
             ->facts(['FAMC'], false, Auth::PRIV_HIDE)
363
-            ->contains(fn (Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'foster');
363
+            ->contains(fn(Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'foster');
364 364
 
365 365
         return $this;
366 366
     }
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
     {
405 405
         $this->matchers[] = static function (array $nodes): bool {
406 406
             if (count($nodes) > 2) {
407
-                $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date('');
408
-                $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date('');
407
+                $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date('');
408
+                $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date('');
409 409
 
410 410
                 return Date::compare($date1, $date2) > 0;
411 411
             }
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
     {
509 509
         $this->matchers[] = static function (array $nodes): bool {
510 510
             if (count($nodes) > 2) {
511
-                $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date('');
512
-                $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date('');
511
+                $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date('');
512
+                $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date('');
513 513
 
514 514
                 return
515 515
                     $date1->isOK() &&
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
     {
541 541
         $this->matchers[] = static function (array $nodes): bool {
542 542
             if (count($nodes) > 2) {
543
-                $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date('');
544
-                $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date('');
543
+                $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date('');
544
+                $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date('');
545 545
 
546 546
                 return Date::compare($date1, $date2) < 0;
547 547
             }
Please login to merge, or discard this patch.
app/Module/LanguageEnglishUnitedStates.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
     public function relationships(): array
119 119
     {
120 120
         // Genitive forms in English are simple/regular, as no relationship name ends in "s".
121
-        $genitive = fn (string $s): array => [$s, $s . '’s %s'];
121
+        $genitive = fn(string $s): array => [$s, $s . '’s %s'];
122 122
 
123
-        $cousin = fn (int $up, int $down): array => $genitive(
123
+        $cousin = fn(int $up, int $down): array => $genitive(
124 124
             (static::COUSIN[min($up, $down)] ?? 'distant cousin') .
125 125
             (static::REMOVED[abs($up - $down)] ?? ' many times removed') .
126 126
             static::DIRECTION[$up <=> $down]
127 127
         );
128 128
 
129
-        $great = fn (int $n, string $prefix, string $suffix): array => $genitive(
129
+        $great = fn(int $n, string $prefix, string $suffix): array => $genitive(
130 130
             $prefix . ($n > 3 ? 'great ×' . $n . ' ' : str_repeat('great-', $n)) . $suffix
131 131
         );
132 132
 
@@ -221,22 +221,22 @@  discard block
 block discarded – undo
221 221
             Relationship::fixed('grandson', 'grandson’s %s')->child()->son(),
222 222
             Relationship::fixed('grandchild', 'grandchild’s %s')->child()->child(),
223 223
             // Relationships with dynamically generated names
224
-            Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'aunt'))->ancestor()->sister(),
225
-            Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'aunt'))->ancestor()->sibling()->wife(),
226
-            Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'uncle'))->ancestor()->brother(),
227
-            Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'uncle'))->ancestor()->sibling()->husband(),
228
-            Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'niece'))->sibling()->descendant()->female(),
229
-            Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'niece'))->married()->spouse()->sibling()->descendant()->female(),
230
-            Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'nephew'))->sibling()->descendant()->male(),
231
-            Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'nephew'))->married()->spouse()->sibling()->descendant()->male(),
232
-            Relationship::dynamic(fn (int $n) => $great($n - 2, 'maternal ', 'grandmother'))->mother()->ancestor()->female(),
233
-            Relationship::dynamic(fn (int $n) => $great($n - 1, 'maternal ', 'grandfather'))->mother()->ancestor()->male(),
234
-            Relationship::dynamic(fn (int $n) => $great($n - 1, 'paternal ', 'grandmother'))->father()->ancestor()->female(),
235
-            Relationship::dynamic(fn (int $n) => $great($n - 1, 'paternal ', 'grandfather'))->father()->ancestor()->male(),
236
-            Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'grandparent'))->ancestor(),
237
-            Relationship::dynamic(fn (int $n) => $great($n - 2, '', 'granddaughter'))->descendant()->female(),
238
-            Relationship::dynamic(fn (int $n) => $great($n - 2, '', 'grandson'))->descendant()->male(),
239
-            Relationship::dynamic(fn (int $n) => $great($n - 2, '', 'grandchild'))->descendant(),
224
+            Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'aunt'))->ancestor()->sister(),
225
+            Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'aunt'))->ancestor()->sibling()->wife(),
226
+            Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'uncle'))->ancestor()->brother(),
227
+            Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'uncle'))->ancestor()->sibling()->husband(),
228
+            Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'niece'))->sibling()->descendant()->female(),
229
+            Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'niece'))->married()->spouse()->sibling()->descendant()->female(),
230
+            Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'nephew'))->sibling()->descendant()->male(),
231
+            Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'nephew'))->married()->spouse()->sibling()->descendant()->male(),
232
+            Relationship::dynamic(fn(int $n) => $great($n - 2, 'maternal ', 'grandmother'))->mother()->ancestor()->female(),
233
+            Relationship::dynamic(fn(int $n) => $great($n - 1, 'maternal ', 'grandfather'))->mother()->ancestor()->male(),
234
+            Relationship::dynamic(fn(int $n) => $great($n - 1, 'paternal ', 'grandmother'))->father()->ancestor()->female(),
235
+            Relationship::dynamic(fn(int $n) => $great($n - 1, 'paternal ', 'grandfather'))->father()->ancestor()->male(),
236
+            Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'grandparent'))->ancestor(),
237
+            Relationship::dynamic(fn(int $n) => $great($n - 2, '', 'granddaughter'))->descendant()->female(),
238
+            Relationship::dynamic(fn(int $n) => $great($n - 2, '', 'grandson'))->descendant()->male(),
239
+            Relationship::dynamic(fn(int $n) => $great($n - 2, '', 'grandchild'))->descendant(),
240 240
             Relationship::dynamic($cousin)->ancestor()->sibling()->descendant(),
241 241
         ];
242 242
     }
Please login to merge, or discard this patch.
app/Module/LanguageFrench.php 1 patch
Spacing   +27 added lines, -28 removed lines patch added patch discarded remove patch
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
         1 => [
35 35
             'F' => ['cousine germaine', '$s de la cousine germaine'],
36 36
             'M' => ['cousin germain', '$s du cousin germain'],
37
-            'U' => ['cousin germain', '%s du cousin germain' ]
37
+            'U' => ['cousin germain', '%s du cousin germain']
38 38
         ],
39 39
         2 => [
40 40
             'F' => ['cousine issue de germain', '$s de la cousine issue de germain'],
41 41
             'M' => ['cousin issu de germain', '$s du cousin issu de germain'],
42
-            'U' => ['cousin issu de germain', '%s du cousin issu de germain' ]
42
+            'U' => ['cousin issu de germain', '%s du cousin issu de germain']
43 43
         ]
44 44
     ];
45 45
 
@@ -66,20 +66,20 @@  discard block
 block discarded – undo
66 66
 
67 67
     public function relationships(): array
68 68
     {
69
-        $genitive = fn (string $s, string $genitive_link): array => [$s, '%s ' . $genitive_link . $s];
69
+        $genitive = fn(string $s, string $genitive_link): array => [$s, '%s ' . $genitive_link . $s];
70 70
 
71
-        $great = fn (int $n, string $suffix, string $genitive_link): array => $genitive(
71
+        $great = fn(int $n, string $suffix, string $genitive_link): array => $genitive(
72 72
             ($n > 2 ? 'arrière-(x' . $n . ')-' : str_repeat('arrière-', max($n, 0))) . $suffix,
73 73
             $n === 0 ? $genitive_link : 'de l’'
74 74
         );
75 75
 
76 76
         $compoundgreat =
77
-            fn (int $n, string $first_level, string $suffix, string $genitive_none, string $genitive_first): array =>
78
-                $great($n - 1, ($n > 0 ? $first_level : '' ) . $suffix, $n === 0 ? $genitive_none : $genitive_first);
77
+            fn(int $n, string $first_level, string $suffix, string $genitive_none, string $genitive_first): array =>
78
+                $great($n - 1, ($n > 0 ? $first_level : '') . $suffix, $n === 0 ? $genitive_none : $genitive_first);
79 79
 
80 80
         $symmetricCousin = fn(int $n, string $sex): array  => self::SYMMETRIC_COUSINS[$n][$sex] ?? $genitive(
81 81
             $sex === 'F' ? 'cousine au ' . $n . '<sup>e</sup> degré' : 'cousin au ' . $n . '<sup>e</sup> degré',
82
-            $sex === 'F'  ? 'de la ' : 'du '
82
+            $sex === 'F' ? 'de la ' : 'du '
83 83
         );
84 84
 
85 85
         $asymmetricCousin =
@@ -94,9 +94,8 @@  discard block
 block discarded – undo
94 94
                 }
95 95
                 return $genitive(
96 96
                     $sex === 'F' ?
97
-                        'cousine du ' . $down . '<sup>e</sup> au ' . $up . '<sup>e</sup> degré' :
98
-                        'cousin du ' . $down . '<sup>e</sup> au ' . $up . '<sup>e</sup> degré',
99
-                    $sex === 'F'  ? 'de la ' : 'du '
97
+                        'cousine du ' . $down . '<sup>e</sup> au ' . $up . '<sup>e</sup> degré' : 'cousin du ' . $down . '<sup>e</sup> au ' . $up . '<sup>e</sup> degré',
98
+                    $sex === 'F' ? 'de la ' : 'du '
100 99
                 );
101 100
             };
102 101
 
@@ -174,26 +173,26 @@  discard block
 block discarded – undo
174 173
             Relationship::fixed('beau-frère', '%s du beau-frère')->sibling()->husband(),
175 174
             Relationship::fixed('beau-frère/belle-sœur', '%s du beau-frère/belle-sœur')->sibling()->spouse(),
176 175
             // Grandparents and above
177
-            Relationship::dynamic(fn (int $n) => $great($n - 1, 'grand-mère maternelle', 'de la '))->mother()->ancestor()->female(),
178
-            Relationship::dynamic(fn (int $n) => $great($n - 1, 'grand-père maternel', 'du '))->mother()->ancestor()->male(),
179
-            Relationship::dynamic(fn (int $n) => $great($n - 1, 'grand-mère paternelle', 'de la '))->father()->ancestor()->female(),
180
-            Relationship::dynamic(fn (int $n) => $great($n - 1, 'grand-père paternel', 'du '))->father()->ancestor()->male(),
181
-            Relationship::dynamic(fn (int $n) => $great($n - 2, 'grand-mère', 'de la '))->ancestor()->female(),
182
-            Relationship::dynamic(fn (int $n) => $great($n - 2, 'grand-père', 'du '))->ancestor()->male(),
183
-            Relationship::dynamic(fn (int $n) => $great($n - 2, 'grand-parent', 'du '))->ancestor(),
176
+            Relationship::dynamic(fn(int $n) => $great($n - 1, 'grand-mère maternelle', 'de la '))->mother()->ancestor()->female(),
177
+            Relationship::dynamic(fn(int $n) => $great($n - 1, 'grand-père maternel', 'du '))->mother()->ancestor()->male(),
178
+            Relationship::dynamic(fn(int $n) => $great($n - 1, 'grand-mère paternelle', 'de la '))->father()->ancestor()->female(),
179
+            Relationship::dynamic(fn(int $n) => $great($n - 1, 'grand-père paternel', 'du '))->father()->ancestor()->male(),
180
+            Relationship::dynamic(fn(int $n) => $great($n - 2, 'grand-mère', 'de la '))->ancestor()->female(),
181
+            Relationship::dynamic(fn(int $n) => $great($n - 2, 'grand-père', 'du '))->ancestor()->male(),
182
+            Relationship::dynamic(fn(int $n) => $great($n - 2, 'grand-parent', 'du '))->ancestor(),
184 183
             // Grandchildren and below
185
-            Relationship::dynamic(fn (int $n) => $great($n - 2, 'petite-fille', 'de la '))->descendant()->female(),
186
-            Relationship::dynamic(fn (int $n) => $great($n - 2, 'petit-fils', 'du '))->descendant()->male(),
187
-            Relationship::dynamic(fn (int $n) => $great($n - 2, 'petit-enfant', 'du'))->descendant(),
184
+            Relationship::dynamic(fn(int $n) => $great($n - 2, 'petite-fille', 'de la '))->descendant()->female(),
185
+            Relationship::dynamic(fn(int $n) => $great($n - 2, 'petit-fils', 'du '))->descendant()->male(),
186
+            Relationship::dynamic(fn(int $n) => $great($n - 2, 'petit-enfant', 'du'))->descendant(),
188 187
             // Collateral relatives
189
-            Relationship::dynamic(fn (int $n) => $compoundgreat($n - 1, 'grand-', 'tante', 'de la ', 'de la '))->ancestor()->sister(),
190
-            Relationship::dynamic(fn (int $n) => $compoundgreat($n - 1, 'grand-', 'tante par alliance', 'de la ', 'de la '))->ancestor()->sibling()->wife(),
191
-            Relationship::dynamic(fn (int $n) => $compoundgreat($n - 1, 'grand-', 'oncle', 'de l’', 'du '))->ancestor()->brother(),
192
-            Relationship::dynamic(fn (int $n) => $compoundgreat($n - 1, 'grand-', 'oncle par alliance', 'de l’', 'du '))->ancestor()->sibling()->husband(),
193
-            Relationship::dynamic(fn (int $n) => $compoundgreat($n - 1, 'petite-', 'nièce', 'de la ', 'de la '))->sibling()->descendant()->female(),
194
-            Relationship::dynamic(fn (int $n) => $compoundgreat($n - 1, 'petite-', 'nièce par alliance', 'de la ', 'de la '))->married()->spouse()->sibling()->descendant()->female(),
195
-            Relationship::dynamic(fn (int $n) => $compoundgreat($n - 1, 'petit-', 'neveu', 'du ', 'du '))->sibling()->descendant()->male(),
196
-            Relationship::dynamic(fn (int $n) => $compoundgreat($n - 1, 'petit-', 'neveu par alliance', 'du ', 'du '))->married()->spouse()->sibling()->descendant()->male(),
188
+            Relationship::dynamic(fn(int $n) => $compoundgreat($n - 1, 'grand-', 'tante', 'de la ', 'de la '))->ancestor()->sister(),
189
+            Relationship::dynamic(fn(int $n) => $compoundgreat($n - 1, 'grand-', 'tante par alliance', 'de la ', 'de la '))->ancestor()->sibling()->wife(),
190
+            Relationship::dynamic(fn(int $n) => $compoundgreat($n - 1, 'grand-', 'oncle', 'de l’', 'du '))->ancestor()->brother(),
191
+            Relationship::dynamic(fn(int $n) => $compoundgreat($n - 1, 'grand-', 'oncle par alliance', 'de l’', 'du '))->ancestor()->sibling()->husband(),
192
+            Relationship::dynamic(fn(int $n) => $compoundgreat($n - 1, 'petite-', 'nièce', 'de la ', 'de la '))->sibling()->descendant()->female(),
193
+            Relationship::dynamic(fn(int $n) => $compoundgreat($n - 1, 'petite-', 'nièce par alliance', 'de la ', 'de la '))->married()->spouse()->sibling()->descendant()->female(),
194
+            Relationship::dynamic(fn(int $n) => $compoundgreat($n - 1, 'petit-', 'neveu', 'du ', 'du '))->sibling()->descendant()->male(),
195
+            Relationship::dynamic(fn(int $n) => $compoundgreat($n - 1, 'petit-', 'neveu par alliance', 'du ', 'du '))->married()->spouse()->sibling()->descendant()->male(),
197 196
             // Cousins (based on canon law)
198 197
             Relationship::dynamic(fn(int $n) => $symmetricCousin($n, 'F'))->symmetricCousin()->female(),
199 198
             Relationship::dynamic(fn(int $n) => $symmetricCousin($n, 'M'))->symmetricCousin()->male(),
Please login to merge, or discard this patch.