forked from gentlero/bitbucket-api
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHPStan: fix first batch of level 6 issues
- Loading branch information
Showing
49 changed files
with
318 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
|
||
/** | ||
* @author Alexandru Guzinschi <[email protected]> | ||
* @phpstan-import-type OptionalClientOption from Client | ||
*/ | ||
class Api | ||
{ | ||
|
@@ -41,7 +42,7 @@ class Api | |
protected $httpClient; | ||
|
||
/** | ||
* @param array $options | ||
* @param OptionalClientOption $options | ||
* @param ClientInterface $client | ||
*/ | ||
public function __construct(array $options = array(), ClientInterface $client = null) | ||
|
@@ -84,6 +85,9 @@ public function setCredentials(Authentication $authentication) | |
$this->addPlugin(new AuthenticationPlugin($authentication)); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function addPlugin(Plugin $plugin) | ||
{ | ||
$this->httpClient->getClientBuilder()->removePlugin(get_class($plugin)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,12 +21,12 @@ | |
|
||
/** | ||
* @author Alexandru G. <[email protected]> | ||
* @phpstan-type ClientOption array{base_url: string, api_version: string, api_versions: string[], format: string, formats: string[], user_agent: string, timeout: int, verify_peer: bool} | ||
* @phpstan-type OptionalClientOption array{base_url?: string, api_version?: string, api_versions?: string[], format?: string, formats?: string[], user_agent?: string, timeout?: int, verify_peer?: bool} | ||
*/ | ||
class Client implements ClientInterface | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
/** @var ClientOption */ | ||
protected $options = array( | ||
'base_url' => 'https://api.bitbucket.org', | ||
'api_version' => '2.0', | ||
|
@@ -45,6 +45,9 @@ class Client implements ClientInterface | |
/** @var HistoryPlugin */ | ||
private $responseHistory; | ||
|
||
/** | ||
* @param OptionalClientOption $options | ||
*/ | ||
public function __construct(array $options = array(), HttpPluginClientBuilder $httpClientBuilder = null) | ||
{ | ||
$this->responseHistory = new HistoryPlugin(); | ||
|
@@ -214,11 +217,11 @@ public function setApiVersion($version) | |
*/ | ||
public function isApiVersion($version) | ||
{ | ||
return abs($this->options['api_version'] - $version) < 0.00001; | ||
return (float) $version === (float) $this->options['api_version']; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
* @return string | ||
*/ | ||
public function getApiBaseUrl() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
parameters: | ||
level: 5 | ||
level: 6 | ||
paths: | ||
- lib | ||
- test | ||
|
||
ignoreErrors: | ||
- '#Method Bitbucket\\[a-z\\]+(TestCase|Test)::[a-z0-9]*provider[a-z0-9]*\(\) return type has no value type specified in iterable type#i' | ||
- '#Method Bitbucket\\[a-z\\]+Test::test[a-z0-9]*\(\) has parameter \$[a-z0-9]+ with no value type specified in iterable type#i' | ||
- '#no value type specified in iterable type array#' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.