Skip to content

Commit 4db3f64

Browse files
committed
adjustments to name and title parsers
1 parent a9fd3c1 commit 4db3f64

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.1.5] - 2026-06-23
6+
- Changed: uppercase first letter in string parser german and english parser rules
7+
- Fixed: title string parser
8+
59
## [0.1.4] - 2026-06-19
610
- Added: has_name translation parameter including default translations if no name is present
711

src/Helper/Titles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function fromString(string $value, ?array $mapping = null): array
5353
continue;
5454
}
5555

56-
if (!isset($mapping[$key][0]) || !($mapping[$key][0] instanceof AbstractTitle)) {
56+
if (!isset($mapping[$key][0]) || !is_a($mapping[$key][0], AbstractTitle::class, true)) {
5757
continue;
5858
}
5959

src/Parser/Name/Rule/Array/EnglishKeyNameRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ public function apply(Value $value): Result
2020
}
2121

2222
if ('firstname' === $value->normalizedKey) {
23-
return new Result(true, firstName: $value->originalValue, origin: $value);
23+
return new Result(true, firstName: ucfirst($value->originalValue), origin: $value);
2424
}
2525
if (\in_array($value->normalizedKey, ['lastname', 'name'])) {
26-
return new Result(true, lastName: $value->originalValue, origin: $value);
26+
return new Result(true, lastName: ucfirst($value->originalValue), origin: $value);
2727
}
2828

2929
return new Result(false);

src/Parser/Name/Rule/Array/GermanKeyNameRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ public function apply(Value $value): Result
2020
}
2121

2222
if (in_array($value->normalizedKey, ['vorname'])) {
23-
return new Result(true, firstName: $value->originalValue, origin: $value);
23+
return new Result(true, firstName: ucfirst($value->originalValue), origin: $value);
2424
}
2525
if (in_array($value->normalizedKey, ['nachname', 'zuname', 'name'])) {
26-
return new Result(true, lastName: $value->originalValue, origin: $value);
26+
return new Result(true, lastName: ucfirst($value->originalValue), origin: $value);
2727
}
2828

2929
return new Result(false);

0 commit comments

Comments
 (0)