GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (74)

src/Credentials/Providers/RamRoleArnProvider.php (8 issues)

Labels
1
<?php
2
3
namespace AlibabaCloud\Client\Credentials\Providers;
4
5
use AlibabaCloud\Client\SDK;
6
use AlibabaCloud\Client\AlibabaCloud;
7
use AlibabaCloud\Client\Result\Result;
8
use AlibabaCloud\Client\Request\Request;
9
use AlibabaCloud\Client\Credentials\StsCredential;
10
use AlibabaCloud\Client\Exception\ClientException;
11
use AlibabaCloud\Client\Exception\ServerException;
12
use AlibabaCloud\Client\Credentials\Requests\AssumeRole;
13
14
/**
15
 * Class RamRoleArnProvider
16
 *
17
 * @package   AlibabaCloud\Client\Credentials\Providers
18
 */
19
class RamRoleArnProvider extends Provider
20
{
21
22
    /**
23
     * Get credential.
24
     *
25
     *
26
     * @param int $timeout
27
     * @param int $connectTimeout
28
     *
29
     * @return StsCredential
30
     * @throws ClientException
31
     * @throws ServerException
32
     */
33 7
    public function get($timeout = Request::TIMEOUT, $connectTimeout = Request::CONNECT_TIMEOUT)
34
    {
35 7
        $credential = $this->getCredentialsInCache();
36
37 7
        if (null === $credential) {
38 6
            $result = $this->request($timeout, $connectTimeout);
39
40 2
            if (!isset($result['Credentials']['AccessKeyId'],
41 2
                $result['Credentials']['AccessKeySecret'],
42 2
                $result['Credentials']['SecurityToken'])) {
43 1
                throw new ServerException($result, $this->error, SDK::INVALID_CREDENTIAL);
44
            }
45
46 1
            $credential = $result['Credentials'];
47 1
            $this->cache($credential);
0 ignored issues
show
It seems like $credential can also be of type null; however, parameter $credential of AlibabaCloud\Client\Cred...iders\Provider::cache() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

47
            $this->cache(/** @scrutinizer ignore-type */ $credential);
Loading history...
48 1
        }
49
50 2
        return new StsCredential(
51 2
            $credential['AccessKeyId'],
52 2
            $credential['AccessKeySecret'],
53 2
            $credential['SecurityToken']
54 2
        );
55
    }
56
57
    /**
58
     * Get credentials by request.
59
     *
60
     * @param $timeout
61
     * @param $connectTimeout
62
     *
63
     * @return Result
64
     * @throws ClientException
65
     * @throws ServerException
66
     */
67 6
    private function request($timeout, $connectTimeout)
68
    {
69 6
        $clientName = __CLASS__ . \uniqid('ak', true);
70 6
        $credential = $this->client->getCredential();
71
72 6
        AlibabaCloud::accessKeyClient(
73 6
            $credential->getAccessKeyId(),
0 ignored issues
show
The method getAccessKeyId() does not exist on AlibabaCloud\Client\Cred...ls\CredentialsInterface. It seems like you code against a sub-type of said class. However, the method does not exist in AlibabaCloud\Client\Cred...ls\RsaKeyPairCredential or AlibabaCloud\Client\Cred...ls\EcsRamRoleCredential. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

73
            $credential->/** @scrutinizer ignore-call */ 
74
                         getAccessKeyId(),
Loading history...
The method getAccessKeyId() does not exist on AlibabaCloud\Client\Cred...ls\EcsRamRoleCredential. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

73
            $credential->/** @scrutinizer ignore-call */ 
74
                         getAccessKeyId(),

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
The method getAccessKeyId() does not exist on AlibabaCloud\Client\Cred...ls\RsaKeyPairCredential. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

73
            $credential->/** @scrutinizer ignore-call */ 
74
                         getAccessKeyId(),

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
74 6
            $credential->getAccessKeySecret()
0 ignored issues
show
The method getAccessKeySecret() does not exist on AlibabaCloud\Client\Cred...ls\CredentialsInterface. It seems like you code against a sub-type of said class. However, the method does not exist in AlibabaCloud\Client\Cred...ls\RsaKeyPairCredential or AlibabaCloud\Client\Cred...ls\EcsRamRoleCredential. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

74
            $credential->/** @scrutinizer ignore-call */ 
75
                         getAccessKeySecret()
Loading history...
The method getAccessKeySecret() does not exist on AlibabaCloud\Client\Cred...ls\EcsRamRoleCredential. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

74
            $credential->/** @scrutinizer ignore-call */ 
75
                         getAccessKeySecret()

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
The method getAccessKeySecret() does not exist on AlibabaCloud\Client\Cred...ls\RsaKeyPairCredential. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

74
            $credential->/** @scrutinizer ignore-call */ 
75
                         getAccessKeySecret()

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
75 6
        )->name($clientName);
76
77 6
        return (new AssumeRole($credential))
0 ignored issues
show
It seems like $credential can also be of type AlibabaCloud\Client\Cred...als\AccessKeyCredential and AlibabaCloud\Client\Cred...s\BearerTokenCredential and AlibabaCloud\Client\Cred...ls\EcsRamRoleCredential and AlibabaCloud\Client\Cred...ls\RsaKeyPairCredential and AlibabaCloud\Client\Credentials\StsCredential; however, parameter $arnCredential of AlibabaCloud\Client\Cred...sumeRole::__construct() does only seem to accept AlibabaCloud\Client\Cred...ls\RamRoleArnCredential, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

77
        return (new AssumeRole(/** @scrutinizer ignore-type */ $credential))
Loading history...
78 6
            ->client($clientName)
79 6
            ->timeout($timeout)
80 6
            ->connectTimeout($connectTimeout)
81 6
            ->debug($this->client->isDebug())
82 6
            ->request();
83
    }
84
}
85