Skip to content

Commit b4a6972

Browse files
committed
Improve PHPDoc - missing @params, variable types, inconsistencies, typos etc.
1 parent 11c7bc5 commit b4a6972

39 files changed

+190
-27
lines changed

lib/WebDriver.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function close();
2828
/**
2929
* Load a new web page in the current browser window.
3030
*
31+
* @param string $url
3132
* @return WebDriver The current instance.
3233
*/
3334
public function get($url);
@@ -91,6 +92,8 @@ public function takeScreenshot($save_as = null);
9192
* WebDriverExpectedCondition::titleIs('WebDriver Page')
9293
* );
9394
*
95+
* @param int $timeout_in_second
96+
* @param int $interval_in_millisecond
9497
* @return WebDriverWait
9598
*/
9699
public function wait(

lib/WebDriverAlert.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function getText() {
5656
/**
5757
* Send keystrokes to javascript prompt() dialog
5858
*
59+
* @param string $value
5960
* @return WebDriverAlert
6061
*/
6162
public function sendKeys($value) {

lib/WebDriverBy.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function getValue() {
4848
* Locates elements whose class name contains the search value; compound class
4949
* names are not permitted.
5050
*
51+
* @param string $class_name
5152
* @return WebDriverBy
5253
*/
5354
public static function className($class_name) {
@@ -57,6 +58,7 @@ public static function className($class_name) {
5758
/**
5859
* Locates elements matching a CSS selector.
5960
*
61+
* @param string $css_selector
6062
* @return WebDriverBy
6163
*/
6264
public static function cssSelector($css_selector) {
@@ -66,6 +68,7 @@ public static function cssSelector($css_selector) {
6668
/**
6769
* Locates elements whose ID attribute matches the search value.
6870
*
71+
* @param string $id
6972
* @return WebDriverBy
7073
*/
7174
public static function id($id) {
@@ -74,6 +77,8 @@ public static function id($id) {
7477

7578
/**
7679
* Locates elements whose NAME attribute matches the search value.
80+
*
81+
* @param string $name
7782
* @return WebDriverBy
7883
*/
7984
public static function name($name) {
@@ -83,6 +88,7 @@ public static function name($name) {
8388
/**
8489
* Locates anchor elements whose visible text matches the search value.
8590
*
91+
* @param string $link_text
8692
* @return WebDriverBy
8793
*/
8894
public static function linkText($link_text) {
@@ -93,6 +99,7 @@ public static function linkText($link_text) {
9399
* Locates anchor elements whose visible text partially matches the search
94100
* value.
95101
*
102+
* @param string $partial_link_text
96103
* @return WebDriverBy
97104
*/
98105
public static function partialLinkText($partial_link_text) {
@@ -102,6 +109,7 @@ public static function partialLinkText($partial_link_text) {
102109
/**
103110
* Locates elements whose tag name matches the search value.
104111
*
112+
* @param string $tag_name
105113
* @return WebDriverBy
106114
*/
107115
public static function tagName($tag_name) {
@@ -111,6 +119,7 @@ public static function tagName($tag_name) {
111119
/**
112120
* Locates elements matching an XPath expression.
113121
*
122+
* @param string $xpath
114123
* @return WebDriverBy
115124
*/
116125
public static function xpath($xpath) {

lib/WebDriverCapabilities.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ interface WebDriverCapabilities {
2121
public function getBrowserName();
2222

2323
/**
24+
* @param string $name
2425
* @return mixed The value of a capability.
2526
*/
2627
public function getCapability($name);
@@ -36,6 +37,7 @@ public function getPlatform();
3637
public function getVersion();
3738

3839
/**
40+
* @param string $capability_name
3941
* @return bool Whether the value is not null and not false.
4042
*/
4143
public function is($capability_name);

lib/WebDriverCommandExecutor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
interface WebDriverCommandExecutor {
2020

2121
/**
22+
* @param WebDriverCommand $command
2223
* @return mixed
2324
*/
2425
public function execute(WebDriverCommand $command);

lib/WebDriverElement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ public function getCSSValue($css_property_name);
5252
/**
5353
* Get the location of element relative to the top-left corner of the page.
5454
*
55-
* @return WebDriverLocation The location of the element.
55+
* @return WebDriverPoint The location of the element.
5656
*/
5757
public function getLocation();
5858

5959
/**
6060
* Try scrolling the element into the view port and return the location of
6161
* element relative to the top-left corner of the page afterwards.
6262
*
63-
* @return WebDriverLocation The location of the element.
63+
* @return WebDriverPoint The location of the element.
6464
*/
6565
public function getLocationOnScreenOnceScrolledIntoView();
6666

lib/WebDriverExceptions.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,18 @@ class WebDriverException extends Exception {
1919

2020
private $results;
2121

22+
/**
23+
* @param string $message
24+
* @param mixed $results
25+
*/
2226
public function __construct($message, $results = null) {
2327
parent::__construct($message);
2428
$this->results = $results;
2529
}
2630

31+
/**
32+
* @return mixed
33+
*/
2734
public function getResults() {
2835
return $this->results;
2936
}
@@ -32,6 +39,10 @@ public function getResults() {
3239
* Throw WebDriverExceptions.
3340
* For $status_code >= 0, they are errors defined in the json wired protocol.
3441
* For $status_code < 0, they are errors defined in php-webdriver.
42+
*
43+
* @param int $status_code
44+
* @param string $message
45+
* @param mixed $results
3546
*/
3647
public static function throwException($status_code, $message, $results) {
3748
switch ($status_code) {
@@ -154,9 +165,13 @@ class UnrecognizedExceptionException extends WebDriverException {}
154165

155166
class UnexpectedTagNameException extends WebDriverException {
156167

168+
/**
169+
* @param string $expected_tag_name
170+
* @param string $actual_tag_name
171+
*/
157172
public function __construct(
158-
string $expected_tag_name,
159-
string $actual_tag_name) {
173+
$expected_tag_name,
174+
$actual_tag_name) {
160175
parent::__construct(
161176
sprintf(
162177
"Element should have been \"%s\" but was \"%s\"",

lib/WebDriverExpectedCondition.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function __construct($apply) {
4040
/**
4141
* An expectation for checking the title of a page.
4242
*
43-
* @param string title The expected title, which must be an exact match.
43+
* @param string $title The expected title, which must be an exact match.
4444
* @return WebDriverExpectedCondition<bool> True when the title matches,
4545
* false otherwise.
4646
*/
@@ -55,7 +55,7 @@ function ($driver) use ($title) {
5555
/**
5656
* An expectation for checking substring of a page Title.
5757
*
58-
* @param string title The expected substring of Title.
58+
* @param string $title The expected substring of Title.
5959
* @return WebDriverExpectedCondition<bool> True when in title,
6060
* false otherwise.
6161
*/
@@ -187,7 +187,7 @@ function ($driver) use ($by, $text) {
187187
* Expectation for checking if iFrame exists.
188188
* If iFrame exists switches driver's focus to the iFrame
189189
*
190-
* @param string frame_locator The locator used to find the iFrame
190+
* @param string $frame_locator The locator used to find the iFrame
191191
* expected to be either the id or name value of the i/frame
192192
* @return WebDriverExpectedCondition<WebDriver> object focused on new frame
193193
* when frame is found bool false otherwise
@@ -328,7 +328,7 @@ function ($driver) use ($condition) {
328328
/**
329329
* An expectation for checking if the given element is selected.
330330
*
331-
* @param mixed element_or_by Either the element or the locator.
331+
* @param mixed $element_or_by Either the element or the locator.
332332
* @return WebDriverExpectedCondition<bool> whether the element is selected.
333333
*/
334334
public static function elementToBeSelected($element_or_by) {

lib/WebDriverKeys.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class WebDriverKeys {
8686

8787
/**
8888
* Encode input of `sendKeys()`.
89-
* @params string|array $keys
89+
* @param string|array $keys
9090
* @return array
9191
*/
9292
public static function encode($keys) {

lib/WebDriverMouse.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,41 @@
1919
interface WebDriverMouse {
2020

2121
/**
22+
* @param WebDriverCoordinates $where
2223
* @return WebDriverMouse
2324
*/
2425
public function click(WebDriverCoordinates $where);
2526

2627
/**
28+
* @param WebDriverCoordinates $where
2729
* @return WebDriverMouse
2830
*/
2931
public function contextClick(WebDriverCoordinates $where);
3032

3133
/**
34+
* @param WebDriverCoordinates $where
3235
* @return WebDriverMouse
3336
*/
3437
public function doubleClick(WebDriverCoordinates $where);
3538

3639
/**
40+
* @param WebDriverCoordinates $where
3741
* @return WebDriverMouse
3842
*/
3943
public function mouseDown(WebDriverCoordinates $where);
4044

4145
/**
46+
* @param WebDriverCoordinates $where
47+
* @param int $x_offset
48+
* @param int $y_offset
4249
* @return WebDriverMouse
4350
*/
4451
public function mouseMove(WebDriverCoordinates $where,
4552
$x_offset = null,
4653
$y_offset = null);
4754

4855
/**
56+
* @param WebDriverCoordinates $where
4957
* @return WebDriverMouse
5058
*/
5159
public function mouseUp(WebDriverCoordinates $where);

0 commit comments

Comments
 (0)