@@ -984,7 +984,7 @@ private function debugCookies(): void
984
984
$ result = [];
985
985
$ cookies = $ this ->webDriver ->manage ()->getCookies ();
986
986
foreach ($ cookies as $ cookie ) {
987
- $ result [] = is_array ( $ cookie ) ? $ cookie : $ cookie ->toArray ();
987
+ $ result [] = $ cookie ->toArray ();
988
988
}
989
989
990
990
$ this ->debugSection ('Cookies ' , json_encode ($ result , JSON_THROW_ON_ERROR ));
@@ -1228,7 +1228,7 @@ public function _findClickable(WebDriverSearchContext $page, $link): ?WebDriverE
1228
1228
return $ this ->matchFirstOrFail ($ page , $ link );
1229
1229
}
1230
1230
1231
- $ locator = static ::xPathLiteral (trim ((string ) $ link ));
1231
+ $ locator = self ::xPathLiteral (trim ((string ) $ link ));
1232
1232
1233
1233
// narrow
1234
1234
$ xpath = Locator::combine (
@@ -1281,7 +1281,7 @@ protected function findFields($selector): array
1281
1281
return $ fields ;
1282
1282
}
1283
1283
1284
- $ locator = static ::xPathLiteral (trim ((string ) $ selector ));
1284
+ $ locator = self ::xPathLiteral (trim ((string ) $ selector ));
1285
1285
// by text or label
1286
1286
$ xpath = Locator::combine (
1287
1287
".//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')][(((./@name = {$ locator }) or ./@id = //label[contains(normalize-space(string(.)), {$ locator })]/@for) or ./@placeholder = {$ locator })] " ,
@@ -1354,7 +1354,7 @@ public function dontSeeLink(string $text, string $url = ''): void
1354
1354
}
1355
1355
}
1356
1356
1357
- private function filterNodesByHref (string $ url , array $ nodes ): ? array
1357
+ private function filterNodesByHref (string $ url , array $ nodes ): array
1358
1358
{
1359
1359
//current uri can be relative, merging it with configured base url gives absolute url
1360
1360
$ absoluteCurrentUrl = Uri::mergeUrls ($ this ->_getUrl (), $ this ->_getCurrentUri ());
@@ -1802,15 +1802,15 @@ protected function findCheckable(
1802
1802
return $ this ->matchFirstOrFail ($ this ->getBaseElement (), $ radioOrCheckbox );
1803
1803
}
1804
1804
1805
- $ locator = static ::xPathLiteral ($ radioOrCheckbox );
1805
+ $ locator = self ::xPathLiteral ($ radioOrCheckbox );
1806
1806
if ($ context instanceof WebDriverElement && $ context ->getTagName () === 'input ' ) {
1807
1807
$ contextType = $ context ->getAttribute ('type ' );
1808
1808
if (!in_array ($ contextType , ['checkbox ' , 'radio ' ], true )) {
1809
1809
return null ;
1810
1810
}
1811
1811
1812
- $ nameLiteral = static ::xPathLiteral ($ context ->getAttribute ('name ' ));
1813
- $ typeLiteral = static ::xPathLiteral ($ contextType );
1812
+ $ nameLiteral = self ::xPathLiteral ($ context ->getAttribute ('name ' ));
1813
+ $ typeLiteral = self ::xPathLiteral ($ contextType );
1814
1814
$ inputLocatorFragment = "input[@type = {$ typeLiteral }][@name = {$ nameLiteral }] " ;
1815
1815
$ xpath = Locator::combine (
1816
1816
"ancestor::form// {$ inputLocatorFragment }[(@id = ancestor::form//label[contains(normalize-space(string(.)), {$ locator })]/@for) or @placeholder = {$ locator }] " ,
@@ -2221,11 +2221,9 @@ public function cancelPopup(): void
2221
2221
* Checks that the active JavaScript popup,
2222
2222
* as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string.
2223
2223
*
2224
- * @param $text
2225
- *
2226
2224
* @throws ModuleException
2227
2225
*/
2228
- public function seeInPopup ($ text ): void
2226
+ public function seeInPopup (string $ text ): void
2229
2227
{
2230
2228
if ($ this ->isPhantom ()) {
2231
2229
throw new ModuleException ($ this , 'PhantomJS does not support working with popups ' );
@@ -2264,10 +2262,9 @@ public function dontSeeInPopup(string $text): void
2264
2262
/**
2265
2263
* Enters text into a native JavaScript prompt popup, as created by `window.prompt`.
2266
2264
*
2267
- * @param $keys
2268
2265
* @throws ModuleException
2269
2266
*/
2270
- public function typeInPopup ($ keys ): void
2267
+ public function typeInPopup (string $ keys ): void
2271
2268
{
2272
2269
if ($ this ->isPhantom ()) {
2273
2270
throw new ModuleException ($ this , 'PhantomJS does not support working with popups ' );
@@ -2883,11 +2880,10 @@ public function waitForJS(string $script, int $timeout = 5): void
2883
2880
* $I->executeJS("window.alert(arguments[0])", ['Hello world']);
2884
2881
* ```
2885
2882
*
2886
- * @param $script
2887
2883
* @param array $arguments
2888
2884
* @return mixed
2889
2885
*/
2890
- public function executeJS ($ script , array $ arguments = [])
2886
+ public function executeJS (string $ script , array $ arguments = [])
2891
2887
{
2892
2888
return $ this ->webDriver ->executeScript ($ script , $ arguments );
2893
2889
}
@@ -2906,11 +2902,10 @@ public function executeJS($script, array $arguments = [])
2906
2902
* $I->executeAsyncJS('setTimeout(arguments[1], arguments[0])', [$seconds]);
2907
2903
* ```
2908
2904
*
2909
- * @param $script
2910
2905
* @param array $arguments
2911
2906
* @return mixed
2912
2907
*/
2913
- public function executeAsyncJS ($ script , array $ arguments = [])
2908
+ public function executeAsyncJS (string $ script , array $ arguments = [])
2914
2909
{
2915
2910
return $ this ->webDriver ->executeAsyncScript ($ script , $ arguments );
2916
2911
}
@@ -2934,7 +2929,7 @@ public function maximizeWindow(): void
2934
2929
* @param string|array|WebDriverBy $source (CSS ID or XPath)
2935
2930
* @param string|array|WebDriverBy $target (CSS ID or XPath)
2936
2931
*/
2937
- public function dragAndDrop (string $ source , string $ target ): void
2932
+ public function dragAndDrop ($ source , $ target ): void
2938
2933
{
2939
2934
$ sourceNodes = $ this ->matchFirstOrFail ($ this ->getBaseElement (), $ source );
2940
2935
$ targetNodes = $ this ->matchFirstOrFail ($ this ->getBaseElement (), $ target );
@@ -3123,7 +3118,7 @@ protected function getStrictLocator(array $by): WebDriverBy
3123
3118
return WebDriverBy::className ($ locator );
3124
3119
default :
3125
3120
throw new MalformedLocatorException (
3126
- "{$ by } => {$ locator }" ,
3121
+ "{$ type } => {$ locator }" ,
3127
3122
"Strict locator can be either xpath, css, id, link, class, name: "
3128
3123
);
3129
3124
}
@@ -3440,10 +3435,8 @@ public function deleteSessionSnapshot($name)
3440
3435
* Check if the cookie domain matches the config URL.
3441
3436
*
3442
3437
* Taken from Guzzle\Cookie\SetCookie
3443
- *
3444
- * @param array|WebDriverCookie $cookie
3445
3438
*/
3446
- private function cookieDomainMatchesConfigUrl (WebDriverCookie $ cookie ): bool
3439
+ private function cookieDomainMatchesConfigUrl (array | WebDriverCookie $ cookie ): bool
3447
3440
{
3448
3441
if (!isset ($ cookie ['domain ' ])) {
3449
3442
return true ;
@@ -3517,11 +3510,10 @@ public function openNewTab(): void
3517
3510
* <?php
3518
3511
* $I->seeNumberOfTabs(2);
3519
3512
* ```
3520
- * @param $number number of tabs
3521
3513
*/
3522
- public function seeNumberOfTabs ($ number ): void
3514
+ public function seeNumberOfTabs (int $ number ): void
3523
3515
{
3524
- $ this ->assertSame ( count ( $ this ->webDriver ->getWindowHandles ()), $ number );
3516
+ $ this ->assertCount ( $ number , $ this ->webDriver ->getWindowHandles ());
3525
3517
}
3526
3518
3527
3519
/**
@@ -3692,13 +3684,13 @@ protected function disableImplicitWait(): void
3692
3684
*
3693
3685
* Examples:
3694
3686
*
3695
- * echo static::xpathLiteral ('foo " bar');
3687
+ * echo self::xPathLiteral ('foo " bar');
3696
3688
* //prints 'foo " bar'
3697
3689
*
3698
- * echo static::xpathLiteral ("foo ' bar");
3690
+ * echo self::xPathLiteral ("foo ' bar");
3699
3691
* //prints "foo ' bar"
3700
3692
*
3701
- * echo static::xpathLiteral ('a\'b"c');
3693
+ * echo self::xPathLiteral ('a\'b"c');
3702
3694
* //prints concat('a', "'", 'b"c')
3703
3695
*
3704
3696
* @return string Converted string
0 commit comments