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 (88)

src/iapis/Ip.php (1 issue)

1
<?php
2
/**
3
 * Class Ip
4
 *
5
 * @link https://www.icy2003.com/
6
 * @author icy2003 <[email protected]>
7
 * @copyright Copyright (c) 2017, icy2003
8
 */
9
namespace icy2003\php\iapis;
10
11
use icy2003\php\ihelpers\Arrays;
12
use icy2003\php\ihelpers\Http;
13
use icy2003\php\ihelpers\Json;
14
15
/**
16
 * Ip 相关接口
17
 */
18
class Ip extends Api
19
{
20
    /**
21
     * 查询 Ip 归属地
22
     *
23
     * @param string $address IP 地址
24
     *
25
     * @return static
26
     */
27
    public function fetchAttribution($address)
28
    {
29
        $this->_result = Json::get(Http::get('https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php', [
0 ignored issues
show
Documentation Bug introduced by
It seems like icy2003\php\ihelpers\Jso...ata.0.location', false) can also be of type false or string. However, the property $_result is declared as type array. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
30
            'query' => $address,
31
            'resource_id' => '6006',
32
            'oe' => 'utf8',
33
        ]), 'data.0.location', false);
34
        $this->_toArrayCall = function ($array) {
35
            list($return['city'], $return['type']) = Arrays::lists(explode(' ', $array), 2);
36
            return $return;
37
        };
38
39
        return $this;
40
    }
41
}
42