1
1
<?php
2
+ declare (strict_types=1 );
3
+
2
4
/**
3
5
* phpDocumentor
4
6
*
22
24
*/
23
25
class Edge
24
26
{
25
- /** @var \phpDocumentor\GraphViz\ Node Node from where to link */
27
+ /** @var Node Node from where to link */
26
28
protected $ from = null ;
27
29
28
- /** @var \phpDocumentor\GraphViz\ Node Node where to to link */
30
+ /** @var Node Node where to to link */
29
31
protected $ to = null ;
30
32
31
- /** @var \phpDocumentor\GraphViz\ Attribute[] List of attributes for this edge */
33
+ /** @var Attribute[] List of attributes for this edge */
32
34
protected $ attributes = [];
33
35
34
36
/**
35
37
* Creates a new Edge / Link between the given nodes.
36
38
*
37
- * @param \phpDocumentor\GraphViz\ Node $from Starting node to create an Edge from.
38
- * @param \phpDocumentor\GraphViz\ Node $to Destination node where to create and
39
+ * @param Node $from Starting node to create an Edge from.
40
+ * @param Node $to Destination node where to create and
39
41
* edge to.
40
42
*/
41
43
public function __construct (Node $ from , Node $ to )
@@ -49,33 +51,27 @@ public function __construct(Node $from, Node $to)
49
51
*
50
52
* See the examples for more details.
51
53
*
52
- * @param \phpDocumentor\GraphViz\Node $from Starting node to create an Edge from.
53
- * @param \phpDocumentor\GraphViz\Node $to Destination node where to create and
54
- * edge to.
55
- *
56
- * @return \phpDocumentor\GraphViz\Edge
54
+ * @param Node $from Starting node to create an Edge from.
55
+ * @param Node $to Destination node where to create and
56
+ * edge to.
57
57
*/
58
- public static function create (Node $ from , Node $ to )
58
+ public static function create (Node $ from , Node $ to ): self
59
59
{
60
60
return new self ($ from , $ to );
61
61
}
62
62
63
63
/**
64
64
* Returns the source Node for this Edge.
65
- *
66
- * @return \phpDocumentor\GraphViz\Node
67
65
*/
68
- public function getFrom ()
66
+ public function getFrom (): Node
69
67
{
70
68
return $ this ->from ;
71
69
}
72
70
73
71
/**
74
72
* Returns the destination Node for this Edge.
75
- *
76
- * @return \phpDocumentor\GraphViz\Node
77
73
*/
78
- public function getTo ()
74
+ public function getTo (): Node
79
75
{
80
76
return $ this ->to ;
81
77
}
@@ -94,13 +90,13 @@ public function getTo()
94
90
* setX or getX.
95
91
* @param mixed[] $arguments Arguments for the setter, only 1 is expected: value
96
92
*
97
- * @return \phpDocumentor\GraphViz\ Attribute|\phpDocumentor\GraphViz\ Edge|null
93
+ * @return Attribute|Edge|null
98
94
*/
99
- public function __call ($ name , $ arguments )
95
+ public function __call (string $ name , array $ arguments )
100
96
{
101
97
$ key = strtolower (substr ($ name , 3 ));
102
98
if (strtolower (substr ($ name , 0 , 3 )) === 'set ' ) {
103
- $ this ->attributes [$ key ] = new Attribute ($ key , $ arguments [0 ]);
99
+ $ this ->attributes [$ key ] = new Attribute ($ key , ( string ) $ arguments [0 ]);
104
100
105
101
return $ this ;
106
102
}
@@ -114,10 +110,8 @@ public function __call($name, $arguments)
114
110
115
111
/**
116
112
* Returns the edge definition as is requested by GraphViz.
117
- *
118
- * @return string
119
113
*/
120
- public function __toString ()
114
+ public function __toString (): string
121
115
{
122
116
$ attributes = [];
123
117
foreach ($ this ->attributes as $ value ) {
0 commit comments