1414namespace phpDocumentor \GraphViz ;
1515
1616use InvalidArgumentException ;
17+
1718use function array_merge ;
1819use function escapeshellarg ;
1920use function exec ;
2627use function sys_get_temp_dir ;
2728use function tempnam ;
2829use function unlink ;
30+
2931use const DIRECTORY_SEPARATOR ;
3032use const PHP_EOL ;
3133
@@ -78,7 +80,7 @@ class Graph
7880 *
7981 * @return Graph
8082 */
81- public static function create (string $ name = 'G ' , bool $ directional = true ) : self
83+ public static function create (string $ name = 'G ' , bool $ directional = true ): self
8284 {
8385 $ graph = new self ();
8486 $ graph
@@ -93,7 +95,7 @@ public static function create(string $name = 'G', bool $directional = true) : se
9395 *
9496 * @param string $path The path to execute dot from
9597 */
96- public function setPath (string $ path ) : self
98+ public function setPath (string $ path ): self
9799 {
98100 $ realpath = realpath ($ path );
99101 if ($ path && $ path === $ realpath ) {
@@ -111,7 +113,7 @@ public function setPath(string $path) : self
111113 *
112114 * @param string $name The new name for this graph.
113115 */
114- public function setName (string $ name ) : self
116+ public function setName (string $ name ): self
115117 {
116118 $ this ->name = $ name ;
117119
@@ -121,7 +123,7 @@ public function setName(string $name) : self
121123 /**
122124 * Returns the name for this Graph.
123125 */
124- public function getName () : string
126+ public function getName (): string
125127 {
126128 return $ this ->name ;
127129 }
@@ -134,7 +136,7 @@ public function getName() : string
134136 * @throws InvalidArgumentException If $type is not "digraph", "graph" or
135137 * "subgraph".
136138 */
137- public function setType (string $ type ) : self
139+ public function setType (string $ type ): self
138140 {
139141 if (!in_array ($ type , ['digraph ' , 'graph ' , 'subgraph ' ], true )) {
140142 throw new InvalidArgumentException (
@@ -151,7 +153,7 @@ public function setType(string $type) : self
151153 /**
152154 * Returns the type of this Graph.
153155 */
154- public function getType () : string
156+ public function getType (): string
155157 {
156158 return $ this ->type ;
157159 }
@@ -160,14 +162,14 @@ public function getType() : string
160162 * Set if the Graph should be strict. If the graph is strict then
161163 * multiple edges are not allowed between the same pairs of nodes
162164 */
163- public function setStrict (bool $ isStrict ) : self
165+ public function setStrict (bool $ isStrict ): self
164166 {
165167 $ this ->strict = $ isStrict ;
166168
167169 return $ this ;
168170 }
169171
170- public function isStrict () : bool
172+ public function isStrict (): bool
171173 {
172174 return $ this ->strict ;
173175 }
@@ -215,7 +217,7 @@ public function __call(string $name, array $arguments)
215217 * @param Graph $graph The graph to add onto this graph as
216218 * subgraph.
217219 */
218- public function addGraph (self $ graph ) : self
220+ public function addGraph (self $ graph ): self
219221 {
220222 $ graph ->setType ('subgraph ' );
221223 $ this ->graphs [$ graph ->getName ()] = $ graph ;
@@ -228,7 +230,7 @@ public function addGraph(self $graph) : self
228230 *
229231 * @param string $name Name of the graph to find.
230232 */
231- public function hasGraph (string $ name ) : bool
233+ public function hasGraph (string $ name ): bool
232234 {
233235 return isset ($ this ->graphs [$ name ]);
234236 }
@@ -238,7 +240,7 @@ public function hasGraph(string $name) : bool
238240 *
239241 * @param string $name Name of the requested graph.
240242 */
241- public function getGraph (string $ name ) : self
243+ public function getGraph (string $ name ): self
242244 {
243245 return $ this ->graphs [$ name ];
244246 }
@@ -253,7 +255,7 @@ public function getGraph(string $name) : self
253255 *
254256 * @param Node $node The node to set onto this Graph.
255257 */
256- public function setNode (Node $ node ) : self
258+ public function setNode (Node $ node ): self
257259 {
258260 $ this ->nodes [$ node ->getName ()] = $ node ;
259261
@@ -265,7 +267,7 @@ public function setNode(Node $node) : self
265267 *
266268 * @param string $name Name of the node to find.
267269 */
268- public function findNode (string $ name ) : ?Node
270+ public function findNode (string $ name ): ?Node
269271 {
270272 if (isset ($ this ->nodes [$ name ])) {
271273 return $ this ->nodes [$ name ];
@@ -289,7 +291,7 @@ public function findNode(string $name) : ?Node
289291 * @param string $name Name of the node.
290292 * @param Node $value Node to set on the given name.
291293 */
292- public function __set (string $ name , Node $ value ) : void
294+ public function __set (string $ name , Node $ value ): void
293295 {
294296 $ this ->nodes [$ name ] = $ value ;
295297 }
@@ -301,7 +303,7 @@ public function __set(string $name, Node $value) : void
301303 *
302304 * @param string $name The name of the node to retrieve.
303305 */
304- public function __get (string $ name ) : ?Node
306+ public function __get (string $ name ): ?Node
305307 {
306308 return $ this ->nodes [$ name ] ?? null ;
307309 }
@@ -313,7 +315,7 @@ public function __get(string $name) : ?Node
313315 *
314316 * @param Edge $edge The link between two classes.
315317 */
316- public function link (Edge $ edge ) : self
318+ public function link (Edge $ edge ): self
317319 {
318320 $ this ->edges [] = $ edge ;
319321
@@ -334,7 +336,7 @@ public function link(Edge $edge) : self
334336 *
335337 * @throws Exception If an error occurred in GraphViz.
336338 */
337- public function export (string $ type , string $ filename ) : self
339+ public function export (string $ type , string $ filename ): self
338340 {
339341 $ type = escapeshellarg ($ type );
340342 $ filename = escapeshellarg ($ filename );
@@ -368,7 +370,7 @@ public function export(string $type, string $filename) : self
368370 * GraphViz is not used in this method; it is safe to call it even without
369371 * GraphViz installed.
370372 */
371- public function __toString () : string
373+ public function __toString (): string
372374 {
373375 $ elements = array_merge (
374376 $ this ->graphs ,
0 commit comments