@@ -984,7 +984,7 @@ private function debugCookies(): void
984984 $ result = [];
985985 $ cookies = $ this ->webDriver ->manage ()->getCookies ();
986986 foreach ($ cookies as $ cookie ) {
987- $ result [] = is_array ( $ cookie ) ? $ cookie : $ cookie ->toArray ();
987+ $ result [] = $ cookie ->toArray ();
988988 }
989989
990990 $ this ->debugSection ('Cookies ' , json_encode ($ result , JSON_THROW_ON_ERROR ));
@@ -1228,7 +1228,7 @@ public function _findClickable(WebDriverSearchContext $page, $link): ?WebDriverE
12281228 return $ this ->matchFirstOrFail ($ page , $ link );
12291229 }
12301230
1231- $ locator = static ::xPathLiteral (trim ((string ) $ link ));
1231+ $ locator = self ::xPathLiteral (trim ((string ) $ link ));
12321232
12331233 // narrow
12341234 $ xpath = Locator::combine (
@@ -1281,7 +1281,7 @@ protected function findFields($selector): array
12811281 return $ fields ;
12821282 }
12831283
1284- $ locator = static ::xPathLiteral (trim ((string ) $ selector ));
1284+ $ locator = self ::xPathLiteral (trim ((string ) $ selector ));
12851285 // by text or label
12861286 $ xpath = Locator::combine (
12871287 ".//*[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
13541354 }
13551355 }
13561356
1357- private function filterNodesByHref (string $ url , array $ nodes ): ? array
1357+ private function filterNodesByHref (string $ url , array $ nodes ): array
13581358 {
13591359 //current uri can be relative, merging it with configured base url gives absolute url
13601360 $ absoluteCurrentUrl = Uri::mergeUrls ($ this ->_getUrl (), $ this ->_getCurrentUri ());
@@ -1802,15 +1802,15 @@ protected function findCheckable(
18021802 return $ this ->matchFirstOrFail ($ this ->getBaseElement (), $ radioOrCheckbox );
18031803 }
18041804
1805- $ locator = static ::xPathLiteral ($ radioOrCheckbox );
1805+ $ locator = self ::xPathLiteral ($ radioOrCheckbox );
18061806 if ($ context instanceof WebDriverElement && $ context ->getTagName () === 'input ' ) {
18071807 $ contextType = $ context ->getAttribute ('type ' );
18081808 if (!in_array ($ contextType , ['checkbox ' , 'radio ' ], true )) {
18091809 return null ;
18101810 }
18111811
1812- $ nameLiteral = static ::xPathLiteral ($ context ->getAttribute ('name ' ));
1813- $ typeLiteral = static ::xPathLiteral ($ contextType );
1812+ $ nameLiteral = self ::xPathLiteral ($ context ->getAttribute ('name ' ));
1813+ $ typeLiteral = self ::xPathLiteral ($ contextType );
18141814 $ inputLocatorFragment = "input[@type = {$ typeLiteral }][@name = {$ nameLiteral }] " ;
18151815 $ xpath = Locator::combine (
18161816 "ancestor::form// {$ inputLocatorFragment }[(@id = ancestor::form//label[contains(normalize-space(string(.)), {$ locator })]/@for) or @placeholder = {$ locator }] " ,
@@ -2221,11 +2221,9 @@ public function cancelPopup(): void
22212221 * Checks that the active JavaScript popup,
22222222 * as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string.
22232223 *
2224- * @param $text
2225- *
22262224 * @throws ModuleException
22272225 */
2228- public function seeInPopup ($ text ): void
2226+ public function seeInPopup (string $ text ): void
22292227 {
22302228 if ($ this ->isPhantom ()) {
22312229 throw new ModuleException ($ this , 'PhantomJS does not support working with popups ' );
@@ -2264,10 +2262,9 @@ public function dontSeeInPopup(string $text): void
22642262 /**
22652263 * Enters text into a native JavaScript prompt popup, as created by `window.prompt`.
22662264 *
2267- * @param $keys
22682265 * @throws ModuleException
22692266 */
2270- public function typeInPopup ($ keys ): void
2267+ public function typeInPopup (string $ keys ): void
22712268 {
22722269 if ($ this ->isPhantom ()) {
22732270 throw new ModuleException ($ this , 'PhantomJS does not support working with popups ' );
@@ -2883,11 +2880,10 @@ public function waitForJS(string $script, int $timeout = 5): void
28832880 * $I->executeJS("window.alert(arguments[0])", ['Hello world']);
28842881 * ```
28852882 *
2886- * @param $script
28872883 * @param array $arguments
28882884 * @return mixed
28892885 */
2890- public function executeJS ($ script , array $ arguments = [])
2886+ public function executeJS (string $ script , array $ arguments = [])
28912887 {
28922888 return $ this ->webDriver ->executeScript ($ script , $ arguments );
28932889 }
@@ -2906,11 +2902,10 @@ public function executeJS($script, array $arguments = [])
29062902 * $I->executeAsyncJS('setTimeout(arguments[1], arguments[0])', [$seconds]);
29072903 * ```
29082904 *
2909- * @param $script
29102905 * @param array $arguments
29112906 * @return mixed
29122907 */
2913- public function executeAsyncJS ($ script , array $ arguments = [])
2908+ public function executeAsyncJS (string $ script , array $ arguments = [])
29142909 {
29152910 return $ this ->webDriver ->executeAsyncScript ($ script , $ arguments );
29162911 }
@@ -2934,7 +2929,7 @@ public function maximizeWindow(): void
29342929 * @param string|array|WebDriverBy $source (CSS ID or XPath)
29352930 * @param string|array|WebDriverBy $target (CSS ID or XPath)
29362931 */
2937- public function dragAndDrop (string $ source , string $ target ): void
2932+ public function dragAndDrop ($ source , $ target ): void
29382933 {
29392934 $ sourceNodes = $ this ->matchFirstOrFail ($ this ->getBaseElement (), $ source );
29402935 $ targetNodes = $ this ->matchFirstOrFail ($ this ->getBaseElement (), $ target );
@@ -3123,7 +3118,7 @@ protected function getStrictLocator(array $by): WebDriverBy
31233118 return WebDriverBy::className ($ locator );
31243119 default :
31253120 throw new MalformedLocatorException (
3126- "{$ by } => {$ locator }" ,
3121+ "{$ type } => {$ locator }" ,
31273122 "Strict locator can be either xpath, css, id, link, class, name: "
31283123 );
31293124 }
@@ -3440,10 +3435,8 @@ public function deleteSessionSnapshot($name)
34403435 * Check if the cookie domain matches the config URL.
34413436 *
34423437 * Taken from Guzzle\Cookie\SetCookie
3443- *
3444- * @param array|WebDriverCookie $cookie
34453438 */
3446- private function cookieDomainMatchesConfigUrl (WebDriverCookie $ cookie ): bool
3439+ private function cookieDomainMatchesConfigUrl (array | WebDriverCookie $ cookie ): bool
34473440 {
34483441 if (!isset ($ cookie ['domain ' ])) {
34493442 return true ;
@@ -3517,11 +3510,10 @@ public function openNewTab(): void
35173510 * <?php
35183511 * $I->seeNumberOfTabs(2);
35193512 * ```
3520- * @param $number number of tabs
35213513 */
3522- public function seeNumberOfTabs ($ number ): void
3514+ public function seeNumberOfTabs (int $ number ): void
35233515 {
3524- $ this ->assertSame ( count ( $ this ->webDriver ->getWindowHandles ()), $ number );
3516+ $ this ->assertCount ( $ number , $ this ->webDriver ->getWindowHandles ());
35253517 }
35263518
35273519 /**
@@ -3692,13 +3684,13 @@ protected function disableImplicitWait(): void
36923684 *
36933685 * Examples:
36943686 *
3695- * echo static::xpathLiteral ('foo " bar');
3687+ * echo self::xPathLiteral ('foo " bar');
36963688 * //prints 'foo " bar'
36973689 *
3698- * echo static::xpathLiteral ("foo ' bar");
3690+ * echo self::xPathLiteral ("foo ' bar");
36993691 * //prints "foo ' bar"
37003692 *
3701- * echo static::xpathLiteral ('a\'b"c');
3693+ * echo self::xPathLiteral ('a\'b"c');
37023694 * //prints concat('a', "'", 'b"c')
37033695 *
37043696 * @return string Converted string
0 commit comments