1 | <?php |
||
23 | class DisjointSet { |
||
24 | private $subsets; |
||
25 | |||
26 | public function __construct() { |
||
27 | $this->subsets = []; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Creates a new set/tree with zero children and parents. |
||
32 | * Its parent points to itself and the rank is 0 when new |
||
33 | * set is created. |
||
34 | * |
||
35 | * @param mixed $data the data to store. |
||
36 | * @return DataStructures\Trees\Nodes\DisjointNode the node created. |
||
37 | */ |
||
38 | public function makeSet($data) : DisjointNode { |
||
44 | |||
45 | /** |
||
46 | * Returns the representative node (the root of $node in the tree) and |
||
47 | * also applies path compression. |
||
48 | * |
||
49 | * @param DataStructures\Trees\Nodes\DisjointNode $node the node from |
||
|
|||
50 | * where start to search the root. |
||
51 | * @return DataStructures\Trees\Nodes\DisjointNode the parent node. |
||
52 | */ |
||
53 | public function find($vertex) { |
||
61 | |||
62 | /** |
||
63 | * Performs the union of two sets (or trees). First looks for |
||
64 | * the root of $x and $y set. Then, if both are in the same tree |
||
65 | * finalize the method. Else, depending of the rank, will join a |
||
66 | * set to other set (The set with lower rank will be append to higher |
||
67 | * one). If both have the same rank it doesn't matter what tree |
||
68 | * is joined to the other tree but the rank will increase. |
||
69 | * |
||
70 | * @param DataStructures\Trees\Nodes\DisjointNode $x The set. |
||
71 | * @param DataStructures\Trees\Nodes\DisjointNode $y The other set. |
||
72 | */ |
||
73 | public function union($vertex1, $vertex2) { |
||
88 | } |
||
89 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.