From 04b2778327570dd75cfd2b27f467cb66078de675 Mon Sep 17 00:00:00 2001 From: Samuel Date: Mon, 23 Sep 2024 11:43:53 +0200 Subject: [PATCH] type method vars --- src/Driver/CoreDriver.php | 76 +++++++++++++++++----------------- src/Driver/DriverInterface.php | 74 ++++++++++++++++----------------- 2 files changed, 75 insertions(+), 75 deletions(-) diff --git a/src/Driver/CoreDriver.php b/src/Driver/CoreDriver.php index 9b4c04e43..633fa4636 100644 --- a/src/Driver/CoreDriver.php +++ b/src/Driver/CoreDriver.php @@ -70,7 +70,7 @@ public function reset() /** * {@inheritdoc} */ - public function visit($url) + public function visit(string $url) { throw new UnsupportedDriverActionException('Visiting an url is not supported by %s', $this); } @@ -94,7 +94,7 @@ public function getContent() /** * {@inheritdoc} */ - public function find($xpath) + public function find(string $xpath) { $elements = array(); @@ -116,7 +116,7 @@ public function find($xpath) * * @throws UnsupportedDriverActionException When operation not supported by the driver */ - protected function findElementXpaths($xpath) + protected function findElementXpaths(string $xpath) { throw new UnsupportedDriverActionException('Finding elements is not supported by %s', $this); } @@ -124,7 +124,7 @@ protected function findElementXpaths($xpath) /** * {@inheritdoc} */ - public function getTagName($xpath) + public function getTagName(string $xpath) { throw new UnsupportedDriverActionException('Getting the tag name is not supported by %s', $this); } @@ -132,7 +132,7 @@ public function getTagName($xpath) /** * {@inheritdoc} */ - public function getText($xpath) + public function getText(string $xpath) { throw new UnsupportedDriverActionException('Getting the element text is not supported by %s', $this); } @@ -140,7 +140,7 @@ public function getText($xpath) /** * {@inheritdoc} */ - public function getHtml($xpath) + public function getHtml(string $xpath) { throw new UnsupportedDriverActionException('Getting the element inner HTML is not supported by %s', $this); } @@ -148,7 +148,7 @@ public function getHtml($xpath) /** * {@inheritdoc} */ - public function getOuterHtml($xpath) + public function getOuterHtml(string $xpath) { throw new UnsupportedDriverActionException('Getting the element outer HTML is not supported by %s', $this); } @@ -156,7 +156,7 @@ public function getOuterHtml($xpath) /** * {@inheritdoc} */ - public function getAttribute($xpath, $name) + public function getAttribute(string $xpath, string $name) { throw new UnsupportedDriverActionException('Getting the element attribute is not supported by %s', $this); } @@ -164,7 +164,7 @@ public function getAttribute($xpath, $name) /** * {@inheritdoc} */ - public function getValue($xpath) + public function getValue(string $xpath) { throw new UnsupportedDriverActionException('Getting the field value is not supported by %s', $this); } @@ -172,7 +172,7 @@ public function getValue($xpath) /** * {@inheritdoc} */ - public function setValue($xpath, $value) + public function setValue(string $xpath, string $value) { throw new UnsupportedDriverActionException('Setting the field value is not supported by %s', $this); } @@ -180,7 +180,7 @@ public function setValue($xpath, $value) /** * {@inheritdoc} */ - public function check($xpath) + public function check(string $xpath) { throw new UnsupportedDriverActionException('Checking a checkbox is not supported by %s', $this); } @@ -188,7 +188,7 @@ public function check($xpath) /** * {@inheritdoc} */ - public function uncheck($xpath) + public function uncheck(string $xpath) { throw new UnsupportedDriverActionException('Unchecking a checkbox is not supported by %s', $this); } @@ -196,7 +196,7 @@ public function uncheck($xpath) /** * {@inheritdoc} */ - public function isChecked($xpath) + public function isChecked(string $xpath) { throw new UnsupportedDriverActionException('Getting the state of a checkbox is not supported by %s', $this); } @@ -204,7 +204,7 @@ public function isChecked($xpath) /** * {@inheritdoc} */ - public function selectOption($xpath, $value, $multiple = false) + public function selectOption(string $xpath, string $value, bool $multiple = false) { throw new UnsupportedDriverActionException('Selecting an option is not supported by %s', $this); } @@ -212,7 +212,7 @@ public function selectOption($xpath, $value, $multiple = false) /** * {@inheritdoc} */ - public function click($xpath) + public function click(string $xpath) { throw new UnsupportedDriverActionException('Clicking on an element is not supported by %s', $this); } @@ -220,7 +220,7 @@ public function click($xpath) /** * {@inheritdoc} */ - public function attachFile($xpath, $path) + public function attachFile(string $xpath, string $path) { throw new UnsupportedDriverActionException('Attaching a file in an input is not supported by %s', $this); } @@ -260,7 +260,7 @@ public function setBasicAuth($user, $password) /** * {@inheritdoc} */ - public function switchToWindow($name = null) + public function switchToWindow(?string $name = null) { throw new UnsupportedDriverActionException('Windows management is not supported by %s', $this); } @@ -268,7 +268,7 @@ public function switchToWindow($name = null) /** * {@inheritdoc} */ - public function switchToIFrame($name = null) + public function switchToIFrame(?string $name = null) { throw new UnsupportedDriverActionException('iFrames management is not supported by %s', $this); } @@ -276,7 +276,7 @@ public function switchToIFrame($name = null) /** * {@inheritdoc} */ - public function setRequestHeader($name, $value) + public function setRequestHeader(string $name, string $value) { throw new UnsupportedDriverActionException('Request headers manipulation is not supported by %s', $this); } @@ -292,7 +292,7 @@ public function getResponseHeaders() /** * {@inheritdoc} */ - public function setCookie($name, $value = null) + public function setCookie(string $name, ?string $value = null) { throw new UnsupportedDriverActionException('Cookies manipulation is not supported by %s', $this); } @@ -300,7 +300,7 @@ public function setCookie($name, $value = null) /** * {@inheritdoc} */ - public function getCookie($name) + public function getCookie(string $name) { throw new UnsupportedDriverActionException('Cookies are not available from %s', $this); } @@ -340,7 +340,7 @@ public function getWindowName() /** * {@inheritdoc} */ - public function doubleClick($xpath) + public function doubleClick(string $xpath) { throw new UnsupportedDriverActionException('Double-clicking is not supported by %s', $this); } @@ -348,7 +348,7 @@ public function doubleClick($xpath) /** * {@inheritdoc} */ - public function rightClick($xpath) + public function rightClick(string $xpath) { throw new UnsupportedDriverActionException('Right-clicking is not supported by %s', $this); } @@ -356,7 +356,7 @@ public function rightClick($xpath) /** * {@inheritdoc} */ - public function isVisible($xpath) + public function isVisible(string $xpath) { throw new UnsupportedDriverActionException('Element visibility check is not supported by %s', $this); } @@ -364,7 +364,7 @@ public function isVisible($xpath) /** * {@inheritdoc} */ - public function isSelected($xpath) + public function isSelected(string $xpath) { throw new UnsupportedDriverActionException('Element selection check is not supported by %s', $this); } @@ -372,7 +372,7 @@ public function isSelected($xpath) /** * {@inheritdoc} */ - public function mouseOver($xpath) + public function mouseOver(string $xpath) { throw new UnsupportedDriverActionException('Mouse manipulations are not supported by %s', $this); } @@ -380,7 +380,7 @@ public function mouseOver($xpath) /** * {@inheritdoc} */ - public function focus($xpath) + public function focus(string $xpath) { throw new UnsupportedDriverActionException('Mouse manipulations are not supported by %s', $this); } @@ -388,7 +388,7 @@ public function focus($xpath) /** * {@inheritdoc} */ - public function blur($xpath) + public function blur(string $xpath) { throw new UnsupportedDriverActionException('Mouse manipulations are not supported by %s', $this); } @@ -396,7 +396,7 @@ public function blur($xpath) /** * {@inheritdoc} */ - public function keyPress($xpath, $char, $modifier = null) + public function keyPress(string $xpath, string $char, ?string $modifier = null) { throw new UnsupportedDriverActionException('Keyboard manipulations are not supported by %s', $this); } @@ -404,7 +404,7 @@ public function keyPress($xpath, $char, $modifier = null) /** * {@inheritdoc} */ - public function keyDown($xpath, $char, $modifier = null) + public function keyDown(string $xpath, string $char, ?string $modifier = null) { throw new UnsupportedDriverActionException('Keyboard manipulations are not supported by %s', $this); } @@ -412,7 +412,7 @@ public function keyDown($xpath, $char, $modifier = null) /** * {@inheritdoc} */ - public function keyUp($xpath, $char, $modifier = null) + public function keyUp(string $xpath, string $char, ?string $modifier = null) { throw new UnsupportedDriverActionException('Keyboard manipulations are not supported by %s', $this); } @@ -420,7 +420,7 @@ public function keyUp($xpath, $char, $modifier = null) /** * {@inheritdoc} */ - public function dragTo($sourceXpath, $destinationXpath) + public function dragTo(string $sourceXpath, string $destinationXpath) { throw new UnsupportedDriverActionException('Mouse manipulations are not supported by %s', $this); } @@ -428,7 +428,7 @@ public function dragTo($sourceXpath, $destinationXpath) /** * {@inheritdoc} */ - public function executeScript($script) + public function executeScript(string $script) { throw new UnsupportedDriverActionException('JS is not supported by %s', $this); } @@ -436,7 +436,7 @@ public function executeScript($script) /** * {@inheritdoc} */ - public function evaluateScript($script) + public function evaluateScript(string $script) { throw new UnsupportedDriverActionException('JS is not supported by %s', $this); } @@ -444,7 +444,7 @@ public function evaluateScript($script) /** * {@inheritdoc} */ - public function wait($timeout, $condition) + public function wait(int $timeout, string $condition) { throw new UnsupportedDriverActionException('JS is not supported by %s', $this); } @@ -452,7 +452,7 @@ public function wait($timeout, $condition) /** * {@inheritdoc} */ - public function resizeWindow($width, $height, $name = null) + public function resizeWindow(int $width, int $height, ?string $name = null) { throw new UnsupportedDriverActionException('Window resizing is not supported by %s', $this); } @@ -460,7 +460,7 @@ public function resizeWindow($width, $height, $name = null) /** * {@inheritdoc} */ - public function maximizeWindow($name = null) + public function maximizeWindow(?string $name = null) { throw new UnsupportedDriverActionException('Window maximize is not supported by %s', $this); } @@ -468,7 +468,7 @@ public function maximizeWindow($name = null) /** * {@inheritdoc} */ - public function submitForm($xpath) + public function submitForm(string $xpath) { throw new UnsupportedDriverActionException('Form submission is not supported by %s', $this); } diff --git a/src/Driver/DriverInterface.php b/src/Driver/DriverInterface.php index f620372e3..890600d8d 100644 --- a/src/Driver/DriverInterface.php +++ b/src/Driver/DriverInterface.php @@ -103,7 +103,7 @@ public function reset(); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function visit($url); + public function visit(string $url); /** * Returns current URL address. @@ -158,7 +158,7 @@ public function setBasicAuth($user, $password); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function switchToWindow($name = null); + public function switchToWindow(?string $name = null); /** * Switches to specific iFrame. @@ -168,7 +168,7 @@ public function switchToWindow($name = null); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function switchToIFrame($name = null); + public function switchToIFrame(?string $name = null); /** * Sets specific request header on client. @@ -179,7 +179,7 @@ public function switchToIFrame($name = null); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function setRequestHeader($name, $value); + public function setRequestHeader(string $name, string $value); /** * Returns last response headers. @@ -200,7 +200,7 @@ public function getResponseHeaders(); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function setCookie($name, $value = null); + public function setCookie(string $name, ?string $value = null); /** * Returns cookie by name. @@ -212,7 +212,7 @@ public function setCookie($name, $value = null); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function getCookie($name); + public function getCookie(string $name); /** * Returns last response status code. @@ -275,7 +275,7 @@ public function getWindowName(); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function find($xpath); + public function find(string $xpath); /** * Returns element's tag name by it's XPath query. @@ -287,7 +287,7 @@ public function find($xpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function getTagName($xpath); + public function getTagName(string $xpath); /** * Returns element's text by it's XPath query. @@ -299,7 +299,7 @@ public function getTagName($xpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function getText($xpath); + public function getText(string $xpath); /** * Returns element's inner html by it's XPath query. @@ -311,7 +311,7 @@ public function getText($xpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function getHtml($xpath); + public function getHtml(string $xpath); /** * Returns element's outer html by it's XPath query. @@ -323,7 +323,7 @@ public function getHtml($xpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function getOuterHtml($xpath); + public function getOuterHtml(string $xpath); /** * Returns element's attribute by it's XPath query. @@ -336,7 +336,7 @@ public function getOuterHtml($xpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function getAttribute($xpath, $name); + public function getAttribute(string $xpath, string $name); /** * Returns element's value by it's XPath query. @@ -350,7 +350,7 @@ public function getAttribute($xpath, $name); * * @see \Behat\Mink\Element\NodeElement::getValue */ - public function getValue($xpath); + public function getValue(string $xpath); /** * Sets element's value by it's XPath query. @@ -363,7 +363,7 @@ public function getValue($xpath); * * @see \Behat\Mink\Element\NodeElement::setValue */ - public function setValue($xpath, $value); + public function setValue(string $xpath, string $value); /** * Checks checkbox by it's XPath query. @@ -375,7 +375,7 @@ public function setValue($xpath, $value); * * @see \Behat\Mink\Element\NodeElement::check */ - public function check($xpath); + public function check(string $xpath); /** * Unchecks checkbox by it's XPath query. @@ -387,7 +387,7 @@ public function check($xpath); * * @see \Behat\Mink\Element\NodeElement::uncheck */ - public function uncheck($xpath); + public function uncheck(string $xpath); /** * Checks whether checkbox or radio button located by it's XPath query is checked. @@ -401,7 +401,7 @@ public function uncheck($xpath); * * @see \Behat\Mink\Element\NodeElement::isChecked */ - public function isChecked($xpath); + public function isChecked(string $xpath); /** * Selects option from select field or value in radio group located by it's XPath query. @@ -415,7 +415,7 @@ public function isChecked($xpath); * * @see \Behat\Mink\Element\NodeElement::selectOption */ - public function selectOption($xpath, $value, $multiple = false); + public function selectOption(string $xpath, string $value, bool $multiple = false); /** * Checks whether select option, located by it's XPath query, is selected. @@ -429,7 +429,7 @@ public function selectOption($xpath, $value, $multiple = false); * * @see \Behat\Mink\Element\NodeElement::isSelected */ - public function isSelected($xpath); + public function isSelected(string $xpath); /** * Clicks button or link located by it's XPath query. @@ -439,7 +439,7 @@ public function isSelected($xpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function click($xpath); + public function click(string $xpath); /** * Double-clicks button or link located by it's XPath query. @@ -449,7 +449,7 @@ public function click($xpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function doubleClick($xpath); + public function doubleClick(string $xpath); /** * Right-clicks button or link located by it's XPath query. @@ -459,7 +459,7 @@ public function doubleClick($xpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function rightClick($xpath); + public function rightClick(string $xpath); /** * Attaches file path to file field located by it's XPath query. @@ -472,7 +472,7 @@ public function rightClick($xpath); * * @see \Behat\Mink\Element\NodeElement::attachFile */ - public function attachFile($xpath, $path); + public function attachFile(string $xpath, string $path); /** * Checks whether element visible located by it's XPath query. @@ -484,7 +484,7 @@ public function attachFile($xpath, $path); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function isVisible($xpath); + public function isVisible(string $xpath); /** * Simulates a mouse over on the element. @@ -494,7 +494,7 @@ public function isVisible($xpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function mouseOver($xpath); + public function mouseOver(string $xpath); /** * Brings focus to element. @@ -504,7 +504,7 @@ public function mouseOver($xpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function focus($xpath); + public function focus(string $xpath); /** * Removes focus from element. @@ -514,7 +514,7 @@ public function focus($xpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function blur($xpath); + public function blur(string $xpath); /** * Presses specific keyboard key. @@ -526,7 +526,7 @@ public function blur($xpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function keyPress($xpath, $char, $modifier = null); + public function keyPress(string $xpath, string $char, ?string $modifier = null); /** * Pressed down specific keyboard key. @@ -538,7 +538,7 @@ public function keyPress($xpath, $char, $modifier = null); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function keyDown($xpath, $char, $modifier = null); + public function keyDown(string $xpath, string $char, ?string $modifier = null); /** * Pressed up specific keyboard key. @@ -550,7 +550,7 @@ public function keyDown($xpath, $char, $modifier = null); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function keyUp($xpath, $char, $modifier = null); + public function keyUp(string $xpath, string $char, ?string $modifier = null); /** * Drag one element onto another. @@ -561,7 +561,7 @@ public function keyUp($xpath, $char, $modifier = null); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function dragTo($sourceXpath, $destinationXpath); + public function dragTo(string $sourceXpath, string $destinationXpath); /** * Executes JS script. @@ -571,7 +571,7 @@ public function dragTo($sourceXpath, $destinationXpath); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function executeScript($script); + public function executeScript(string $script); /** * Evaluates JS script. @@ -586,7 +586,7 @@ public function executeScript($script); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function evaluateScript($script); + public function evaluateScript(string $script); /** * Waits some time or until JS condition turns true. @@ -599,7 +599,7 @@ public function evaluateScript($script); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function wait($timeout, $condition); + public function wait(int $timeout, string $condition); /** * Set the dimensions of the window. @@ -611,7 +611,7 @@ public function wait($timeout, $condition); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function resizeWindow($width, $height, $name = null); + public function resizeWindow(int $width, int $height, ?string $name = null); /** * Maximizes the window if it is not maximized already. @@ -621,7 +621,7 @@ public function resizeWindow($width, $height, $name = null); * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function maximizeWindow($name = null); + public function maximizeWindow(?string $name = null); /** * Submits the form. @@ -633,5 +633,5 @@ public function maximizeWindow($name = null); * * @see \Behat\Mink\Element\NodeElement::submitForm */ - public function submitForm($xpath); + public function submitForm(string $xpath); }