Skip to content

Commit 6ad739e

Browse files
authored
Merge pull request #12 from php-api-clients/deal-with-pluses-and-minus-signs-in-property-names
Deal with pluses and minus signs in property names
2 parents a1815c9 + e3c83cb commit 6ad739e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Generator/Schema.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,15 @@ public static function generate(string $name, string $namespace, string $classNa
5151
);
5252

5353
foreach ($schema->properties as $propertyName => $property) {
54-
$propertyName = trim($propertyName, '@');
54+
$propertyName = str_replace([
55+
'@',
56+
'+',
57+
'-',
58+
], [
59+
'_AT_',
60+
'_PLUSES_',
61+
'_MINUS_',
62+
], $propertyName);
5563
$propertyStmt = $factory->property($propertyName)->makePrivate();
5664
$docBlock = [];
5765
if (strlen($property->description) > 0) {

0 commit comments

Comments
 (0)