Skip to content

Commit e89259c

Browse files
committed
add string typehint for selector arg
1 parent 332026d commit e89259c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/Rct567/DomQuery/DomQuery.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public function html($html_string=null)
296296
*
297297
* @return self|string
298298
*/
299-
public function attr($name, $val=null)
299+
public function attr(string $name, $val=null)
300300
{
301301
if (!is_null($val)) { // set attribute for all nodes
302302
foreach ($this->nodes as $node) {
@@ -323,7 +323,7 @@ public function attr($name, $val=null)
323323
*
324324
* @return mixed
325325
*/
326-
public function prop($name, $val=null)
326+
public function prop(string $name, $val=null)
327327
{
328328

329329
if (!is_null($val)) { // set attribute for all nodes
@@ -350,7 +350,7 @@ public function prop($name, $val=null)
350350
*
351351
* @return self
352352
*/
353-
public function children($selector='*')
353+
public function children(string $selector='*')
354354
{
355355
if (strpos($selector, ',') !== false) {
356356
$selectors = explode(',', $selector);
@@ -375,7 +375,7 @@ public function children($selector='*')
375375
*
376376
* @return self|void
377377
*/
378-
public function parent($selector=null)
378+
public function parent(string $selector=null)
379379
{
380380

381381
if (isset($this->document) && $this->length > 0) {
@@ -470,7 +470,7 @@ public function filter(string $selector)
470470
*
471471
* @return boolean
472472
*/
473-
public function is($selector)
473+
public function is(string $selector)
474474
{
475475
if ($this->length > 0) {
476476
$xpath_query = self::cssToXpath($selector);
@@ -514,7 +514,7 @@ public function get($index)
514514
*
515515
* @return self|void
516516
*/
517-
public function first($selector=null)
517+
public function first(string $selector=null)
518518
{
519519
if (isset($this[0])) {
520520
$result = $this[0];
@@ -532,7 +532,7 @@ public function first($selector=null)
532532
*
533533
* @return self|void
534534
*/
535-
public function last($selector=null)
535+
public function last(string $selector=null)
536536
{
537537
if ($this->length > 0 && isset($this[$this->length-1])) {
538538
$result = $this[$this->length-1];
@@ -550,7 +550,7 @@ public function last($selector=null)
550550
*
551551
* @return self|void
552552
*/
553-
public function next($selector=null)
553+
public function next(string $selector=null)
554554
{
555555
if (isset($this->document) && $this->length > 0) {
556556
$result = new self($this->document);
@@ -576,7 +576,7 @@ public function next($selector=null)
576576
*
577577
* @return self|void
578578
*/
579-
public function prev($selector=null)
579+
public function prev(string $selector=null)
580580
{
581581
if (isset($this->document) && $this->length > 0) {
582582
$result = new self($this->document);
@@ -602,7 +602,7 @@ public function prev($selector=null)
602602
*
603603
* @return self
604604
*/
605-
public function remove($selector=null)
605+
public function remove(string $selector=null)
606606
{
607607
$result = $this;
608608
if ($selector) {
@@ -726,7 +726,7 @@ public function __call($name, $arguments)
726726
*
727727
* @return \DOMNodeList|false
728728
*/
729-
public function xpathQuery(string $expression, \DOMNode $context_node=null)
729+
public function xpathQuery(string $expression, \DOMNode $context_node=null)
730730
{
731731
if ($this->dom_xpath) {
732732
$node_list = $this->dom_xpath->query($expression, $context_node);
@@ -741,7 +741,6 @@ public function xpathQuery(string $expression, \DOMNode $context_node=null)
741741
}
742742

743743
return false;
744-
745744
}
746745

747746
/**

0 commit comments

Comments
 (0)