1 | <?php |
||
27 | class Discover extends Creator |
||
28 | { |
||
29 | /** |
||
30 | * This array is meant as a cache of the last entry per depth. |
||
31 | * |
||
32 | * To build a hierarchy from a non-recursive method, such as visitSection(), you need a way to reference the last |
||
33 | * Entry per depth. |
||
34 | * |
||
35 | * By keeping track of these pointers you know onto which parent you will need to add a node by checking which of |
||
36 | * higher depth was parsed last. |
||
37 | * |
||
38 | * Important: because it is possible that levels are 'skipped' we will need to unset all 'deeper' depths when |
||
39 | * setting a new one. Otherwise we might inadvertently add an entry to the wrong tree. |
||
40 | * |
||
41 | * @var TableOfContents\Heading[] |
||
42 | */ |
||
43 | protected $entry_pointers = []; |
||
44 | |||
45 | /** |
||
46 | * This is a pointer to the last discovered heading. |
||
47 | * |
||
48 | * Directives and roles may 'include' Files as children of the currently parsed heading. Elements as the toctree |
||
49 | * directive or a plain include are examples of such. |
||
50 | * |
||
51 | * @var TableOfContents\Heading |
||
52 | */ |
||
53 | protected $last_heading = null; |
||
54 | |||
55 | public function visit(\ezcDocumentRstDocumentNode $ast) |
||
65 | |||
66 | /** |
||
67 | * Visitor for the section heading used to populate the TableOfContents. |
||
68 | * |
||
69 | * This method interprets the heading and its containing text and adds new entries to the TableOfContents object |
||
70 | * in the RestructuredText document. |
||
71 | * |
||
72 | * @see getDocument() for the document containing the TableOfContents. |
||
73 | * @see phpDocumentor\Plugin\Scrybe\Converter\Metadata\TableOfContents for the Table of Contents class. |
||
74 | */ |
||
75 | protected function visitSection(\DOMNode $root, \ezcDocumentRstNode $node) |
||
105 | |||
106 | /** |
||
107 | * Adds a TableOfContents File object to the last heading that was discovered. |
||
108 | * |
||
109 | * This may be used by roles or directives to insert an include file into the TableOfContents and thus all |
||
110 | * its headings. |
||
111 | * |
||
112 | * This method is explicitly bound to File objects and not other BaseEntry descendents because inline elements |
||
113 | * such as headings should also modify the internal pointers for this visitor. |
||
114 | */ |
||
115 | public function addFileToLastHeading(TableOfContents\File $file) |
||
120 | } |
||
121 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: