@@ -415,7 +415,7 @@ public function getAttribute($xpath, $name)
415
415
*/
416
416
public function getValue ($ xpath )
417
417
{
418
- if (in_array ($ this ->getAttribute ($ xpath , 'type ' ), array ('submit ' , 'image ' , 'button ' ))) {
418
+ if (in_array ($ this ->getAttribute ($ xpath , 'type ' ), array ('submit ' , 'image ' , 'button ' ), true )) {
419
419
return $ this ->getAttribute ($ xpath , 'value ' );
420
420
}
421
421
@@ -487,25 +487,25 @@ public function isSelected($xpath)
487
487
$ selectField = $ this ->getFormField ('( ' . $ xpath . ')/ancestor-or-self::*[local-name()="select"] ' );
488
488
$ selectValue = $ selectField ->getValue ();
489
489
490
- return is_array ($ selectValue ) ? in_array ($ optionValue , $ selectValue ) : $ optionValue == $ selectValue ;
490
+ return is_array ($ selectValue ) ? in_array ($ optionValue , $ selectValue, true ) : $ optionValue = == $ selectValue ;
491
491
}
492
492
493
493
/**
494
494
* {@inheritdoc}
495
495
*/
496
496
public function click ($ xpath )
497
497
{
498
- $ node = $ this ->getFilteredCrawler ($ xpath );
499
- $ crawlerNode = $ this ->getCrawlerNode ($ node );
500
- $ tagName = $ crawlerNode ->nodeName ;
498
+ $ crawler = $ this ->getFilteredCrawler ($ xpath );
499
+ $ node = $ this ->getCrawlerNode ($ crawler );
500
+ $ tagName = $ node ->nodeName ;
501
501
502
502
if ('a ' === $ tagName ) {
503
- $ this ->client ->click ($ node ->link ());
503
+ $ this ->client ->click ($ crawler ->link ());
504
504
$ this ->forms = array ();
505
- } elseif ($ this ->canSubmitForm ($ crawlerNode )) {
506
- $ this ->submit ($ node ->form ());
507
- } elseif ($ this ->canResetForm ($ crawlerNode )) {
508
- $ this ->resetForm ($ crawlerNode );
505
+ } elseif ($ this ->canSubmitForm ($ node )) {
506
+ $ this ->submit ($ crawler ->form ());
507
+ } elseif ($ this ->canResetForm ($ node )) {
508
+ $ this ->resetForm ($ node );
509
509
} else {
510
510
$ message = sprintf ('%%s supports clicking on links and submit or reset buttons only. But "%s" provided ' , $ tagName );
511
511
@@ -810,11 +810,11 @@ private function canSubmitForm(\DOMElement $node)
810
810
{
811
811
$ type = $ node ->hasAttribute ('type ' ) ? $ node ->getAttribute ('type ' ) : null ;
812
812
813
- if ('input ' == $ node ->nodeName && in_array ($ type , array ('submit ' , 'image ' ))) {
813
+ if ('input ' === $ node ->nodeName && in_array ($ type , array ('submit ' , 'image ' ), true )) {
814
814
return true ;
815
815
}
816
816
817
- return 'button ' == $ node ->nodeName && (null === $ type || 'submit ' == $ type );
817
+ return 'button ' === $ node ->nodeName && (null === $ type || 'submit ' = == $ type );
818
818
}
819
819
820
820
/**
@@ -828,7 +828,7 @@ private function canResetForm(\DOMElement $node)
828
828
{
829
829
$ type = $ node ->hasAttribute ('type ' ) ? $ node ->getAttribute ('type ' ) : null ;
830
830
831
- return in_array ($ node ->nodeName , array ('input ' , 'button ' )) && 'reset ' == $ type ;
831
+ return in_array ($ node ->nodeName , array ('input ' , 'button ' ), true ) && 'reset ' = == $ type ;
832
832
}
833
833
834
834
/**
@@ -881,10 +881,10 @@ private function mergeForms(Form $to, Form $from)
881
881
$ nodeReflection ->setAccessible (true );
882
882
$ valueReflection ->setAccessible (true );
883
883
884
- if (!( $ field instanceof InputFormField && in_array (
885
- $ nodeReflection ->getValue ($ field )->getAttribute ('type ' ),
886
- array ( ' submit ' , ' button ' , ' image ' )
887
- )) ) {
884
+ $ isIgnoredField = $ field instanceof InputFormField &&
885
+ in_array ( $ nodeReflection ->getValue ($ field )->getAttribute ('type ' ), array ( ' submit ' , ' button ' , ' image ' ), true );
886
+
887
+ if (! $ isIgnoredField ) {
888
888
$ valueReflection ->setValue ($ to [$ name ], $ valueReflection ->getValue ($ field ));
889
889
}
890
890
}
0 commit comments