Closed baloo42 closed 3 years ago
Hi @balux phuml
does not support nullable types yet. I'm working on the last feature I have planned for 1.x Show namespace information
Then I'll start working on v2 which will include nullable types.
Really like this project. We want to use it to get more insights on bigger projects. Grouping the classes with their namespaces sounds good for that use case too.
Do you have more plans on v2? Is it worth to work on Nullable Types on the actual code?
I think it's safe to work on nullable types. I started coding that new feature and I think I'll be able to isolate the changes to the PhUml\Graphviz
package and the resources\templates
directory.
You'd be working on the PhUml\Parser\Code\Builders\Member
package and the class Variable
to show the ?
for nullable types in the diagram.
I've pushed my current progress to 1.8. If you want to start working on nullable types you could base off your branch from 1.8. I'll create 2.0 once you finish.
The main changes for 2.0.0 are support for PHP 7 and changes to the options names/values for the commands.
The same thing happened to me when trying to run
phuml phuml:diagram -r -a -o -p neato . test.png
@dingo-d You can edit buildParameters
this in src/Parser/Code/Builders/Members/MethodsBuilder.php
:
private function buildParameters(array $parameters, ?string $docBlock): array
{
return array_map(function (Param $parameter) use ($docBlock) {
$name = "\${$parameter->name}";
$type = $parameter->type;
if ($type !== null) {
if($type instanceof \PhpParser\Node\NullableType) {
$type = $type->type;
}
$typeDeclaration = TypeDeclaration::from($type);
} else {
$typeDeclaration = MethodDocBlock::from($docBlock)->typeOfParameter($name);
}
return Variable::declaredWith($name, $typeDeclaration);
}, $parameters);
}
This works, thanks!
This should work now
docker pull montealegreluis/phuml:2.0.0
# or
composer require phuml/phuml:2.0.0
Please let me know if you run into issues
I get some errors with this code:
PHP Version:
7.2.4