| 1 | <?php |
||
| 18 | trait NodeTrait |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var callable[] |
||
| 22 | */ |
||
| 23 | private $onReplace = []; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param callable $callback |
||
| 27 | * @return $this |
||
| 28 | */ |
||
| 29 | public function setOnReplace(callable $callback) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @return Document |
||
| 37 | */ |
||
| 38 | public function getOwnerDocument() |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @return Element |
||
| 46 | */ |
||
| 47 | public function getParentNode() |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param string $html |
||
| 55 | * @return NodeInterface |
||
| 56 | * @throws Exception\LogicException |
||
| 57 | */ |
||
| 58 | public function replaceWith($html) |
||
| 73 | } |
||
| 74 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: