Skip to content

Commit 952bd0c

Browse files
committed
Add factory for string enum value object - Close #7
1 parent 758dc30 commit 952bd0c

11 files changed

+655
-86
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@
3434
"require": {
3535
"php": "^7.4 || ^8.0",
3636
"open-code-modeling/json-schema-to-php": "dev-master",
37-
"open-code-modeling/php-code-ast": "^0.8.2|dev-master"
37+
"open-code-modeling/php-code-ast": "^0.8.6|dev-master"
3838
},
3939
"require-dev": {
4040
"jangregor/phpstan-prophecy": "^0.8.0",
41+
"laminas/laminas-filter": "^2.9",
4142
"phpspec/prophecy-phpunit": "^2.0",
4243
"phpstan/phpstan": "^0.12.33",
4344
"phpstan/phpstan-strict-rules": "^0.12.4",

src/ValueObject/DateTimeFactory.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,14 @@ public function nodeVisitorsFromNative(string $name, string $outputFormat = DATE
124124
{
125125
$nodeVisitors = $this->propertyFactory->nodeVisitorFromNative($name, 'DateTimeImmutable');
126126

127+
$classConstant = $this->classConstant($outputFormat);
128+
127129
\array_unshift(
128130
$nodeVisitors,
129131
new ClassConstant(
130132
new IdentifierGenerator(
131-
'OUTPUT_FORMAT',
132-
$this->classConstant($outputFormat)
133+
$classConstant->getName(),
134+
$classConstant
133135
)
134136
)
135137
);

0 commit comments

Comments
 (0)