1 | <?php |
||
8 | class TreeNodePrinter implements Visitor { |
||
9 | |||
10 | private $depth = 0; |
||
11 | private $rowNumber = 0; |
||
12 | private $configuration = null; |
||
13 | /** |
||
14 | * @var TreeResultPrinter |
||
15 | */ |
||
16 | private $resultPrinter = null; |
||
17 | private $columnLabels = []; |
||
18 | |||
19 | 5 | public function __construct( TreeResultPrinter $resultPrinter, $configuration ) { |
|
23 | |||
24 | 5 | public function visit( NodeInterface $node ) { |
|
25 | |||
26 | 5 | $nodeTexts = [ $this->getTextForNode( $node ) ]; |
|
|
|||
27 | |||
28 | 5 | $this->depth++; |
|
29 | 5 | $this->rowNumber++; |
|
30 | |||
31 | 5 | foreach ( $node->getChildren() as $child ) { |
|
32 | 5 | $nodeTexts = array_merge( |
|
33 | 5 | $nodeTexts, |
|
34 | 5 | $child->accept( $this ) |
|
35 | ); |
||
36 | } |
||
37 | |||
38 | 5 | $this->depth--; |
|
39 | |||
40 | 5 | return $nodeTexts; |
|
41 | } |
||
42 | |||
43 | 5 | protected function getTextForNode( TreeNode $node ) { |
|
65 | |||
66 | /** |
||
67 | * @param \SMWResultArray[] $row |
||
68 | * @return string |
||
69 | */ |
||
70 | 5 | protected function getTextForRowNoTemplate( $row ) { |
|
99 | |||
100 | /** |
||
101 | * @param \SMWResultArray[] $row |
||
102 | * @return string |
||
103 | */ |
||
104 | 3 | protected function getTextForRowWithTemplate( $row ) { |
|
119 | |||
120 | /** |
||
121 | * @param \SMWResultArray $cell |
||
122 | * @param int $columnNumber |
||
123 | * @return string |
||
124 | */ |
||
125 | 5 | protected function getValuesTextForCell( \SMWResultArray $cell, $columnNumber ) { |
|
139 | |||
140 | /** |
||
141 | * @param \SMWResultArray $cell |
||
142 | * @param int $columnNumber |
||
143 | * @return string |
||
144 | */ |
||
145 | 3 | protected function getParamNameForCell( $cell, $columnNumber ) { |
|
164 | |||
165 | /** |
||
166 | * @param \SMWResultArray $cell |
||
167 | * @return string |
||
168 | */ |
||
169 | 5 | protected function getLabelForCell( $cell, $columnNumber ) { |
|
186 | |||
187 | } |
||
188 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.