src/Guzzle/Guzzle.php
The method logRejection uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
Open
} else {
$message = $reason;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Return type of post()
is undeclared type \Psr\Http\Message\ResponseInterface
Open
Open
public function post(string $uri, array $options = []) : ResponseInterface
- Exclude checks
Call to method warning
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->warning($message);
- Exclude checks
Call to method post
from undeclared class \GuzzleHttp\Client
(Did you mean class \Nopolabs\Yabot\Slack\Client) Open
Open
return $this->client->post($uri, $options);
- Exclude checks
Call to method put
from undeclared class \GuzzleHttp\Client
(Did you mean class \Nopolabs\Yabot\Slack\Client) Open
Open
return $this->client->put($uri, $options);
- Exclude checks
Parameter $log
has undeclared type ?\Psr\Log\LoggerInterface
Open
Open
public function __construct(Client $client, LoggerInterface $log = null)
- Exclude checks
Call to method get
from undeclared class \GuzzleHttp\Client
(Did you mean class \Nopolabs\Yabot\Slack\Client) Open
Open
return $this->client->get($uri, $options);
- Exclude checks
Return type of getClient()
is undeclared type \GuzzleHttp\Client
(Did you mean class \Nopolabs\Yabot\Slack\Client) Open
Open
public function getClient() : Client
- Exclude checks
Return type of get()
is undeclared type \Psr\Http\Message\ResponseInterface
Open
Open
public function get(string $uri, array $options = []) : ResponseInterface
- Exclude checks
Property \Nopolabs\Yabot\Guzzle\Guzzle->client
has undeclared type \GuzzleHttp\Client
(Did you mean class \Nopolabs\Yabot\Slack\Client) Open
Open
private $client;
- Exclude checks
Return type of put()
is undeclared type \Psr\Http\Message\ResponseInterface
Open
Open
public function put(string $uri, array $options = []) : ResponseInterface
- Exclude checks
Return type of getAsync()
is undeclared type \GuzzleHttp\Promise\PromiseInterface
Open
Open
public function getAsync(string $uri, array $options = [], callable $onRejected = null) : PromiseInterface
- Exclude checks
Call to method postAsync
from undeclared class \GuzzleHttp\Client
(Did you mean class \Nopolabs\Yabot\Slack\Client) Open
Open
return $this->client->postAsync($uri, $options)->then(null, $onRejected);
- Exclude checks
Call to method getAsync
from undeclared class \GuzzleHttp\Client
(Did you mean class \Nopolabs\Yabot\Slack\Client) Open
Open
return $this->client->getAsync($uri, $options)->then(null, $onRejected);
- Exclude checks
Parameter $client
has undeclared type \GuzzleHttp\Client
(Did you mean class \Nopolabs\Yabot\Slack\Client) Open
Open
public function __construct(Client $client, LoggerInterface $log = null)
- Exclude checks
Return type of postAsync()
is undeclared type \GuzzleHttp\Promise\PromiseInterface
Open
Open
public function postAsync(string $uri, array $options = [], callable $onRejected = null) : PromiseInterface
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
Open
$onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
- Exclude checks
Each PHP statement must be on a line by itself Open
Open
$onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
Open
$onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
- Exclude checks
Each PHP statement must be on a line by itself Open
Open
$onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
- Exclude checks
There must be one blank line after the namespace declaration Open
Open
namespace Nopolabs\Yabot\Guzzle;
- Exclude checks
Opening brace must be the last content on the line Open
Open
$onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
- Exclude checks
Expected 1 newline at end of file; 0 found Open
Open
}
- Exclude checks
Closing brace must be on a line by itself Open
Open
$onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
- Exclude checks
Closing brace must be on a line by itself Open
Open
$onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
- Exclude checks
Opening brace must be the last content on the line Open
Open
$onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
- Exclude checks