MontealegreLuis/phuml

[BUG] FQN is lost when dealing with union types in TypeDeclaration::references()

Amegatron opened this issue · 2 comments

In union types, FQN of it's components is lost when getting their referecnes(). For example, if I have a class property (attribute) with type My\Intersting\SuperType|null, references() will return type just SuperType with the rest part of FQN truncated.

I believe this is because of this line: https://github.com/MontealegreLuis/phuml/blob/master/src/Code/Variables/TypeDeclaration.php#L74

When casting Name to string, it uses only the last part of it. Not sure if it's inteded or not, but seems ->fullName() should be used there.

Hi @Amegatron you're absolutely right that's the line with the issue, and the solution is the one you suggested.

This test case is missing one entry with a class with a namespace: https://github.com/MontealegreLuis/phuml/blob/master/tests/unit/Code/Variables/TypeDeclarationTest.php#L107

This is a good first issue for anyone looking to start contributing to phUML.

Fixed in #19