I am reading M. Zandstra’s book "PHP. Objects, Patterns, and Programming Techniques" and sketching a test example, I decided to build his UML diagram in PHPStorm. In the PHPStorm menu, I found the corresponding functionality in the menu: when I click on a file, I right-click the context menu of this file -> Diagrams -> Show Diagram.

As a result, I got a chart: enter image description here

for the following code:

interface red {} class primary implements red { private $moon; function __construct( composcl $moon){ $this->moon = $moon; } public function fokkd() { return $this->moon->catg($this); } public function getfstr() :string { return " First root class"; } } class childone extends primary { } class childtwo extends primary { } class composcl { public function catg( primary $obj) :string { return "Delegation in use: ".$obj->getfstr(); } } $obj = new primary( new composcl() ); echo $obj->fokkd(); 

But why is the composition not marked? (a filled diamond going from the primary class to the composcl class). Indeed, in the primary class there is a permanent link to an instance of the composcl class. PHPStorm does not draw full UML? Or is there an error in my code? What program or service can I scan a project and build a full UML diagram for it?

1 answer 1

In PHPStorm, you cannot build a UML class interaction diagram, alas. To build similar graphs (not UML) I use phpda . Pretty good and more or less customizable and extensible tool for analyzing the interaction of classes in the application.