| 1 | <?php |
||
| 12 | class SectionNode extends ANode |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * The name of the section. |
||
| 16 | * |
||
| 17 | * @access protected |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $name; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Real constructor. |
||
| 25 | * |
||
| 26 | * @access protected |
||
| 27 | * |
||
| 28 | * @return \Htsl\Parser\Node\Contracts\ANode |
||
|
|
|||
| 29 | */ |
||
| 30 | protected function construct():parent |
||
| 31 | { |
||
| 32 | $this->name= $this->line->pregGet('/(?<=\( ).*(?= \))/'); |
||
| 33 | |||
| 34 | return $this; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Opening this node, and returning node opener. |
||
| 39 | * |
||
| 40 | * @access public |
||
| 41 | * |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | public function open():string |
||
| 45 | { |
||
| 46 | $this->document->setSection(new Section($this->name)); |
||
| 47 | |||
| 48 | return ''; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Close this node, and returning node closer. |
||
| 53 | * |
||
| 54 | * @access public |
||
| 55 | * |
||
| 56 | * @param \Htsl\ReadingBuffer\Line $closerLine The line when node closed. |
||
| 57 | * |
||
| 58 | * @return string |
||
| 59 | */ |
||
| 60 | public function close( Line$closerLine ):string |
||
| 66 | } |
||
| 67 |
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.