From bc2aa6fa9b234ecf6882950c6cd6586ceead1162 Mon Sep 17 00:00:00 2001 From: John Nicholls Date: Wed, 1 Jun 2016 12:08:28 +0100 Subject: [PATCH] Add type hinting and DocBlock comments To enable IDEs to understand the responses from find() --- .../simplehtmldom_1_5/simple_html_dom.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php index aa4357f..a214a33 100644 --- a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php +++ b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php @@ -131,7 +131,7 @@ class simple_html_dom_node public $tag_start = 0; private $dom = null; - function __construct($dom) + function __construct(simple_html_dom $dom) { $this->dom = $dom; $dom->nodes[] = $this; @@ -504,8 +504,14 @@ function makeup() return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>'; } - // find elements by css selector - //PaperG - added ability for find to lowercase the value of the selector. + /** + * find elements by css selector + * PaperG - added ability for find to lowercase the value of the selector. + * @param string $selector + * @param null $idx + * @param bool $lowercase + * @return simple_html_dom_node[]|simple_html_dom_node|null + */ function find($selector, $idx=null, $lowercase=false) { $selectors = $this->parse_selector($selector); @@ -977,6 +983,7 @@ function appendChild($node) {$node->parent($this); return $node;} */ class simple_html_dom { + /** @var simple_html_dom_node $root */ public $root = null; public $nodes = array(); public $callback = null; @@ -1724,5 +1731,3 @@ function getElementByTagName($name) {return $this->find($name, 0);} function getElementsByTagName($name, $idx=-1) {return $this->find($name, $idx);} function loadFile() {$args = func_get_args();$this->load_file($args);} } - -?>