These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | require_once __DIR__ . '/../vendor/autoload.php'; |
||
4 | |||
5 | $adapter = new \Habrahabr\Api\HttpAdapter\CurlAdapter(); |
||
6 | $adapter->setStrictSSL(true); |
||
7 | $adapter->setEndpoint(getenv('ENDPOINT')); |
||
8 | $adapter->setToken(getenv('TOKEN')); |
||
9 | $adapter->setClient(getenv('CLIENT')); |
||
10 | |||
11 | $client = new \Habrahabr\Api\Client($adapter); |
||
12 | |||
13 | $HubInfo = $client->getHubResource()->getHubInfo('php'); |
||
0 ignored issues
–
show
|
|||
14 | $HubHabred = $client->getHubResource()->getFeedHabred('php', 2); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Habrahabr\Api\Resources\ResourceInterface as the method getFeedHabred() does only exist in the following implementations of said interface: Habrahabr\Api\Resources\FeedResource , Habrahabr\Api\Resources\HubResource .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
15 | $HubUnhabred = $client->getHubResource()->getFeedUnhabred('php', 2); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Habrahabr\Api\Resources\ResourceInterface as the method getFeedUnhabred() does only exist in the following implementations of said interface: Habrahabr\Api\Resources\FeedResource , Habrahabr\Api\Resources\HubResource .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
16 | $HubNew = $client->getHubResource()->getFeedNew('php'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Habrahabr\Api\Resources\ResourceInterface as the method getFeedNew() does only exist in the following implementations of said interface: Habrahabr\Api\Resources\FeedResource , Habrahabr\Api\Resources\HubResource .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
17 | |||
18 | $hubs = $client->getHubResource()->getHubList(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Habrahabr\Api\Resources\ResourceInterface as the method getHubList() does only exist in the following implementations of said interface: Habrahabr\Api\Resources\HubResource .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
19 | $hubs = $client->getHubResource()->getHubCategories(); |
||
0 ignored issues
–
show
The method
getHubCategories() does not seem to exist on object<Habrahabr\Api\Resources\ResourceInterface> .
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...
|
|||
20 | $hubs = $client->getHubResource()->getHubOfCategory('telecommunications'); |
||
0 ignored issues
–
show
The method
getHubOfCategory() does not seem to exist on object<Habrahabr\Api\Resources\ResourceInterface> .
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...
|
|||
21 | $hubs = $client->getHubResource()->searchHubs('web'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Habrahabr\Api\Resources\ResourceInterface as the method searchHubs() does only exist in the following implementations of said interface: Habrahabr\Api\Resources\SearchResource .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
22 | |||
23 | $hubs = $client->getHubResource()->unsubscribeHub('php'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Habrahabr\Api\Resources\ResourceInterface as the method unsubscribeHub() does only exist in the following implementations of said interface: Habrahabr\Api\Resources\HubResource .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
24 | var_dump($hubs); |
||
25 |
Let’s take a look at an example:
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.
Available Fixes
Change the type-hint for the parameter:
Add an additional type-check:
Add the method to the interface: