json-to-php-generator
json-to-php-generator copied to clipboard
Duplicate classes
Source
{
"elements": {
"test": 1,
"elements": [
{
"elements": {
"test": 1,
"elements": []
}
}
]
}
}
Result
final class RootObject
{
public Elements $elements;
}
final class Elements
{
public int $test;
/** @var Elements[] */
public array $elements;
}
final class Elements
{
public Elements $elements;
}
final class Elements
{
public int $test;
public array $elements;
}
Hi,
Thank you for reporting this issue. I think we should add incrementing suffixes to nested classes with the same name to make it clear which object is being used. It's hard to determine which nested classes are of the same type, so we can't just merge the classes with the same name.
I ran into this as well. The duplicated files are identical and if they are they can be rendered only once.