From e3c83cbc8bf3b6910f1a45b863a0ba7030e9210a Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Mon, 3 May 2021 23:46:51 +0200 Subject: [PATCH] Deal with pluses and minus signs in property names --- src/Generator/Schema.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Generator/Schema.php b/src/Generator/Schema.php index 840b93a..0308e1d 100644 --- a/src/Generator/Schema.php +++ b/src/Generator/Schema.php @@ -51,7 +51,15 @@ public static function generate(string $name, string $namespace, string $classNa ); foreach ($schema->properties as $propertyName => $property) { - $propertyName = trim($propertyName, '@'); + $propertyName = str_replace([ + '@', + '+', + '-', + ], [ + '_AT_', + '_PLUSES_', + '_MINUS_', + ], $propertyName); $propertyStmt = $factory->property($propertyName)->makePrivate(); $docBlock = []; if (strlen($property->description) > 0) {