Skip to content

Commit f7ae8c1

Browse files
committed
phpstan (level 3) clean-up
1 parent b3af591 commit f7ae8c1

File tree

11 files changed

+35
-32
lines changed

11 files changed

+35
-32
lines changed

lib/WebDriver/AbstractWebDriver.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function getCurlService()
134134
/**
135135
* Set transient options
136136
*
137-
* @param array $transientOptions
137+
* @param mixed $transientOptions
138138
*/
139139
public function setTransientOptions($transientOptions)
140140
{
@@ -162,11 +162,11 @@ public function isLegacy()
162162
/**
163163
* Curl request to webdriver server.
164164
*
165-
* @param string $requestMethod HTTP request method, e.g., 'GET', 'POST', or 'DELETE'
166-
* @param string $command If not defined in methods() this function will throw.
167-
* @param array $parameters If an array(), they will be posted as JSON parameters
168-
* If a number or string, "/$params" is appended to url
169-
* @param array $extraOptions key=>value pairs of curl options to pass to curl_setopt()
165+
* @param string $requestMethod HTTP request method, e.g., 'GET', 'POST', or 'DELETE'
166+
* @param string $command If not defined in methods() this function will throw.
167+
* @param array|string|integer $parameters If an array(), they will be posted as JSON parameters
168+
* If a number or string, "/$params" is appended to url
169+
* @param array $extraOptions key=>value pairs of curl options to pass to curl_setopt()
170170
*
171171
* @return array array('value' => ..., 'info' => ...)
172172
*

lib/WebDriver/Container.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ protected function webDriverElement($value)
227227
$this->legacy
228228
);
229229
}
230+
231+
return null;
230232
}
231233

232234
/**

lib/WebDriver/Exception/CurlExec.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,22 @@ final class CurlExec extends BaseException
3939
private $curlInfo = array();
4040

4141
/**
42-
* {@inheritdoc}
42+
* Get curl info
43+
*
44+
* @return array
4345
*/
44-
public function __construct($message = null, $code = 0, \Exception $previous = null, $curlInfo = array())
46+
public function getCurlInfo()
4547
{
46-
parent::__construct($message, $code, $previous);
47-
48-
$this->curlInfo = $curlInfo;
48+
return $this->curlInfo;
4949
}
5050

5151
/**
52-
* Get curl info
52+
* Set curl info
5353
*
54-
* @return array
54+
* @param array $curlInfo
5555
*/
56-
public function getCurlInfo()
56+
public function setCurlInfo($curlInfo)
5757
{
58-
return $this->curlInfo;
58+
$this->curlInfo = $curlInfo;
5959
}
6060
}

lib/WebDriver/SauceLabs/SauceRest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function getCurlService()
9191
/**
9292
* Set transient options
9393
*
94-
* @param array $transientOptions
94+
* @param mixed $transientOptions
9595
*/
9696
public function setTransientOptions($transientOptions)
9797
{
@@ -345,7 +345,7 @@ public function getStatus()
345345
*
346346
* @return array
347347
*/
348-
public function getBrowsers($termination = false)
348+
public function getBrowsers($termination = '')
349349
{
350350
if ($termination) {
351351
return $this->execute('GET', 'info/browsers/' . $termination);

lib/WebDriver/Service/CurlService.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
namespace WebDriver\Service;
2626

27-
use WebDriver\Exception as WebDriverException;
27+
use WebDriver\Exception\CurlExec as CurlExecException;
2828

2929
/**
3030
* WebDriver\Service\CurlService class
@@ -41,7 +41,7 @@ class CurlService implements CurlServiceInterface
4141
/**
4242
* Constructor
4343
*
44-
* @param array $defaultOptions
44+
* @param mixed $defaultOptions
4545
*/
4646
public function __construct($defaultOptions = array())
4747
{
@@ -126,19 +126,20 @@ public function execute($requestMethod, $url, $parameters = null, $extraOptions
126126
) {
127127
curl_close($curl);
128128

129-
throw WebDriverException::factory(
130-
WebDriverException::CURL_EXEC,
129+
$e = new CurlExecException(
131130
sprintf(
132131
"Curl error thrown for http %s to %s%s\n\n%s",
133132
$requestMethod,
134133
$url,
135134
$parameters && is_array($parameters) ? ' with params: ' . json_encode($parameters) : '',
136135
$error
137136
),
138-
$errno,
139-
null,
140-
$info
137+
$errno
141138
);
139+
140+
$e->setCurlInfo($info);
141+
142+
throw $e;
142143
}
143144

144145
curl_close($curl);

lib/WebDriver/ServiceFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private function __construct()
6767
*/
6868
public static function getInstance()
6969
{
70-
if (! self::$instance) {
70+
if (self::$instance === null) {
7171
self::$instance = new self();
7272
}
7373

lib/WebDriver/Session.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public function touch()
395395
* local_storage method chaining, e.g.,
396396
* - $session->local_storage()->method()
397397
*
398-
* @return \WebDriver\Storage
398+
* @return \WebDriver\Storage\Local
399399
*/
400400
public function localStorage()
401401
{
@@ -406,7 +406,7 @@ public function localStorage()
406406
* session_storage method chaining, e.g.,
407407
* - $session->session_storage()->method()
408408
*
409-
* @return \WebDriver\Storage
409+
* @return \WebDriver\Storage\Session
410410
*/
411411
public function sessionStorage()
412412
{

lib/WebDriver/Storage/AbstractStorage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function get()
7272
/**
7373
* Set specific key/value pair
7474
*
75-
* @return \WebDriver\AbstractStorage
75+
* @return \WebDriver\Storage\AbstractStorage
7676
*
7777
* @throw \WebDriver\Exception\UnexpectedParameters if unexpected parameters
7878
*/
@@ -100,7 +100,7 @@ public function set()
100100
/**
101101
* Delete storage or a specific key
102102
*
103-
* @return \WebDriver\AbstractStorage
103+
* @return \WebDriver\Storage\AbstractStorage
104104
*
105105
* @throw \WebDriver\Exception\UnexpectedParameters if unexpected parameters
106106
*/

lib/WebDriver/Timeouts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function methods()
4848
/**
4949
* helper method to wait until user-defined condition is met
5050
*
51-
* @param function $callback callback which returns non-false result if wait condition was met
51+
* @param callable $callback callback which returns non-false result if wait condition was met
5252
* @param integer $maxIterations maximum number of iterations
5353
* @param integer $sleep sleep duration in seconds between iterations
5454
* @param array $args optional args; if the callback needs $this, then pass it here

lib/WebDriver/WebDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
* @package WebDriver
3030
*
31-
* @method status
31+
* @method array status()
3232
*/
3333
class WebDriver extends AbstractWebDriver implements WebDriverInterface
3434
{

0 commit comments

Comments
 (0)