Skip to content

Commit

Permalink
Bump up phpstan version and fix reported errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed May 21, 2021
1 parent c25469b commit 52ede77
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Expand Up @@ -9,3 +9,4 @@ tests export-ignore
.scrutinizer.yml export-ignore
phpunit.xml.dist export-ignore
phpmd.xml.dist export-ignore
phpstan.neon export-ignore
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -68,4 +68,4 @@ jobs:

- name: Run phpstan
if: success() || failure()
run: vendor/bin/phpstan.phar analyse src/ tests/ --no-progress --level 2
run: vendor/bin/phpstan
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -37,7 +37,7 @@
"squizlabs/php_codesniffer": "^3.3.2",
"phpunit/phpunit": "^7.5",
"socialconnect/http-client": "^1.0",
"phpstan/phpstan-shim": "^0.11.12"
"phpstan/phpstan": "^0.12.88"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 10 additions & 0 deletions phpstan.neon
@@ -0,0 +1,10 @@
parameters:
level: 4
paths:
- src/
- tests/
ignoreErrors:
-
message: "#^Method Test\\\\Provider\\\\ProviderMock\\:\\:getAccessTokenByRequestParameters\\(\\) should return SocialConnect\\\\Provider\\\\AccessTokenInterface but return statement is missing\\.$#"
count: 1
path: tests/Test/Provider/ProviderMock.php
4 changes: 1 addition & 3 deletions src/OAuth1/Provider/Atlassian.php
Expand Up @@ -104,11 +104,9 @@ public function __construct(HttpStack $httpStack, SessionInterface $session, arr
*/
public function getIdentity(AccessTokenInterface $accessToken)
{
$this->consumerToken = $accessToken;

$parameters = [
'oauth_consumer_key' => $this->consumer->getKey(),
'oauth_token' => $this->consumerToken->getToken(),
'oauth_token' => $accessToken->getToken(),
];

$response = $this->oauthRequest(
Expand Down
2 changes: 0 additions & 2 deletions src/OAuth1/Provider/Px500.php
Expand Up @@ -63,8 +63,6 @@ public function getName()
*/
public function getIdentity(AccessTokenInterface $accessToken)
{
$this->consumerToken = $accessToken;

$result = $this->request(
'GET',
'users',
Expand Down
2 changes: 0 additions & 2 deletions src/OAuth1/Provider/Trello.php
Expand Up @@ -62,8 +62,6 @@ public function getName()
*/
public function getIdentity(AccessTokenInterface $accessToken)
{
$this->consumerToken = $accessToken;

$parameters = [
'key' => $this->consumer->getKey(),
'token' => $accessToken->getToken()
Expand Down
2 changes: 0 additions & 2 deletions src/OAuth1/Provider/Tumblr.php
Expand Up @@ -63,8 +63,6 @@ public function getName()
*/
public function getIdentity(AccessTokenInterface $accessToken)
{
$this->consumerToken = $accessToken;

$result = $this->request(
'GET',
'user/info',
Expand Down
2 changes: 0 additions & 2 deletions src/OAuth1/Provider/Twitter.php
Expand Up @@ -45,8 +45,6 @@ public function getName()
*/
public function getIdentity(AccessTokenInterface $accessToken)
{
$this->consumerToken = $accessToken;

$result = $this->request(
'GET',
'account/verify_credentials.json',
Expand Down
2 changes: 1 addition & 1 deletion src/OpenID/AbstractProvider.php
Expand Up @@ -73,7 +73,7 @@ protected function discover(string $url)
$xml = new \SimpleXMLElement($response->getBody()->getContents());

$this->version = 2;
$this->loginEntrypoint = $xml->XRD->Service->URI;
$this->loginEntrypoint = (string)$xml->XRD->Service->URI;

return $this->getOpenIdUrl();
}
Expand Down
3 changes: 3 additions & 0 deletions tests/Test/Provider/ProviderMock.php
Expand Up @@ -6,6 +6,7 @@

namespace Test\Provider;

use SocialConnect\Common\Entity\User;
use SocialConnect\Provider\AbstractBaseProvider;
use SocialConnect\Provider\AccessTokenInterface;

Expand All @@ -17,6 +18,7 @@ class ProviderMock extends AbstractBaseProvider
public function getBaseUri()
{
// TODO: Implement getBaseUri() method.
return '';
}

/**
Expand Down Expand Up @@ -58,6 +60,7 @@ public function makeAuthUrl(): string
public function getIdentity(AccessTokenInterface $accessToken)
{
// TODO: Implement getIdentity() method.
return new User();
}

/**
Expand Down

0 comments on commit 52ede77

Please sign in to comment.