Skip to content

Commit 909cbdd

Browse files
committed
Merge remote-tracking branch 'origin/0.5.x-merge-up-into-0.6.x_602c2bf27a0b40.98054646' into 0.6.x
# Conflicts: # CHANGELOG.md
2 parents 0ef06fd + b8e013e commit 909cbdd

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ All notable changes to this project will be documented in this file, in reverse
2424

2525
- Nothing.
2626

27+
## 0.5.2 - 2021-02-16
28+
29+
30+
-----
31+
32+
### Release Notes for [0.5.2](https://github.com/open-code-modeling/json-schema-to-php-ast/milestone/13)
33+
34+
0.5.x bugfix release (patch)
35+
36+
### 0.5.2
37+
38+
- Total issues resolved: **1**
39+
- Total pull requests resolved: **0**
40+
- Total contributors: **1**
41+
42+
#### bug
43+
44+
- [24: Fix uuid to string methods](https://github.com/open-code-modeling/json-schema-to-php-ast/issues/24) thanks to @sandrokeil
45+
2746
## 0.5.1 - 2021-02-12
2847

2948

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
"scripts": {
5555
"check": [
5656
"@cs",
57-
"@test"
57+
"@test",
58+
"@static-analysis"
5859
],
5960
"cs": "php-cs-fixer fix -v --diff --dry-run",
6061
"cs-fix": "php-cs-fixer fix -v --diff",

src/ValueObject/UuidFactory.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ public function classBuilderFromNative(string $name): ClassBuilder
118118
$this->methodToString($name)->generate(),
119119
$this->methodEquals($name)->generate(),
120120
$this->methodMagicToString($name)->generate(),
121-
)->setTyped($this->typed);
121+
)->setTyped($this->typed)
122+
->addNamespaceImport(
123+
'Ramsey\Uuid\Uuid',
124+
'Ramsey\Uuid\UuidInterface',
125+
);
122126
}
123127

124128
public function methodFromString(string $argumentName): MethodGenerator
@@ -164,7 +168,7 @@ public function methodToString(string $propertyName): MethodGenerator
164168
'toString',
165169
[],
166170
MethodGenerator::FLAG_PUBLIC,
167-
new BodyGenerator($this->parser, 'return $this->' . $propertyName . ';')
171+
new BodyGenerator($this->parser, 'return $this->' . $propertyName . '->toString();')
168172
);
169173
$method->setTyped($this->typed);
170174
$method->setReturnType('string');
@@ -207,7 +211,7 @@ public function methodMagicToString(string $propertyName): MethodGenerator
207211
'__toString',
208212
[],
209213
MethodGenerator::FLAG_PUBLIC,
210-
new BodyGenerator($this->parser, 'return $this->' . $propertyName . ';')
214+
new BodyGenerator($this->parser, 'return $this->' . $propertyName . '->toString();')
211215
);
212216
$method->setTyped($this->typed);
213217
$method->setReturnType('string');

tests/ValueObject/UuidFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private function __construct(UuidInterface $uuid)
101101
}
102102
public function toString() : string
103103
{
104-
return $this->uuid;
104+
return $this->uuid->toString();
105105
}
106106
public function equals($other) : bool
107107
{
@@ -112,7 +112,7 @@ public function equals($other) : bool
112112
}
113113
public function __toString() : string
114114
{
115-
return $this->uuid;
115+
return $this->uuid->toString();
116116
}
117117
}
118118
EOF;

0 commit comments

Comments
 (0)