Skip to content

Commit 6785e95

Browse files
committed
Remove ucfirst() call because the filter must do the job
1 parent 550f3e7 commit 6785e95

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/ValueObject/EnumFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public function methodFromString(string $argumentName): MethodGenerator
275275

276276
private function throwExceptionLine(string $argumentName): string
277277
{
278-
$name = ($this->constValueFilter)($argumentName);
278+
$name = \ucfirst(($this->constValueFilter)($argumentName));
279279

280280
return 'throw Invalid' . $name . '::for' . $name . '($' . $argumentName . ');';
281281
}
@@ -362,7 +362,7 @@ public function methodMagicToString(string $argumentName): MethodGenerator
362362
public function methodEnumNamedConstructor(string $enumValue): MethodGenerator
363363
{
364364
$method = new MethodGenerator(
365-
\lcfirst(($this->constValueFilter)($enumValue)),
365+
($this->constValueFilter)($enumValue),
366366
[],
367367
MethodGenerator::FLAG_PUBLIC | MethodGenerator::FLAG_STATIC,
368368
new BodyGenerator($this->parser, \sprintf('return new self(self::%s);', ($this->constNameFilter)($enumValue)))

tests/ValueObject/BaseTestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function setUp(): void
4545
$filterConstValue->attach(new Filter\Word\SeparatorToSeparator(' ', '-'));
4646
$filterConstValue->attach(new Filter\Word\UnderscoreToCamelCase());
4747
$filterConstValue->attach(new Filter\Word\DashToCamelCase());
48+
$filterConstValue->attach(function(string $value) { return \lcfirst($value); });
4849

4950
$this->filterConstValue = $filterConstValue;
5051

0 commit comments

Comments
 (0)