nopolabs/yabot

View on GitHub
src/Guzzle/Guzzle.php

Summary

Maintainability
A
0 mins
Test Coverage

The method logRejection uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $message = $reason;
        }
Severity: Minor
Found in src/Guzzle/Guzzle.php by phpmd

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

    public function post(string $uri, array $options = []) : ResponseInterface
Severity: Minor
Found in src/Guzzle/Guzzle.php by phan

Call to method warning from undeclared class \Psr\Log\LoggerInterface
Open

        $this->getLog()->warning($message);
Severity: Critical
Found in src/Guzzle/Guzzle.php by phan

Call to method post from undeclared class \GuzzleHttp\Client (Did you mean class \Nopolabs\Yabot\Slack\Client)
Open

        return $this->client->post($uri, $options);
Severity: Critical
Found in src/Guzzle/Guzzle.php by phan

Call to method put from undeclared class \GuzzleHttp\Client (Did you mean class \Nopolabs\Yabot\Slack\Client)
Open

        return $this->client->put($uri, $options);
Severity: Critical
Found in src/Guzzle/Guzzle.php by phan

Parameter $log has undeclared type ?\Psr\Log\LoggerInterface
Open

    public function __construct(Client $client, LoggerInterface $log = null)
Severity: Minor
Found in src/Guzzle/Guzzle.php by phan

Call to method get from undeclared class \GuzzleHttp\Client (Did you mean class \Nopolabs\Yabot\Slack\Client)
Open

        return $this->client->get($uri, $options);
Severity: Critical
Found in src/Guzzle/Guzzle.php by phan

Return type of getClient() is undeclared type \GuzzleHttp\Client (Did you mean class \Nopolabs\Yabot\Slack\Client)
Open

    public function getClient() : Client
Severity: Minor
Found in src/Guzzle/Guzzle.php by phan

Return type of get() is undeclared type \Psr\Http\Message\ResponseInterface
Open

    public function get(string $uri, array $options = []) : ResponseInterface
Severity: Minor
Found in src/Guzzle/Guzzle.php by phan

Property \Nopolabs\Yabot\Guzzle\Guzzle->client has undeclared type \GuzzleHttp\Client (Did you mean class \Nopolabs\Yabot\Slack\Client)
Open

    private $client;
Severity: Minor
Found in src/Guzzle/Guzzle.php by phan

Return type of put() is undeclared type \Psr\Http\Message\ResponseInterface
Open

    public function put(string $uri, array $options = []) : ResponseInterface
Severity: Minor
Found in src/Guzzle/Guzzle.php by phan

Return type of getAsync() is undeclared type \GuzzleHttp\Promise\PromiseInterface
Open

    public function getAsync(string $uri, array $options = [], callable $onRejected = null) : PromiseInterface
Severity: Minor
Found in src/Guzzle/Guzzle.php by phan

Call to method postAsync from undeclared class \GuzzleHttp\Client (Did you mean class \Nopolabs\Yabot\Slack\Client)
Open

        return $this->client->postAsync($uri, $options)->then(null, $onRejected);
Severity: Critical
Found in src/Guzzle/Guzzle.php by phan

Call to method getAsync from undeclared class \GuzzleHttp\Client (Did you mean class \Nopolabs\Yabot\Slack\Client)
Open

        return $this->client->getAsync($uri, $options)->then(null, $onRejected);
Severity: Critical
Found in src/Guzzle/Guzzle.php by phan

Parameter $client has undeclared type \GuzzleHttp\Client (Did you mean class \Nopolabs\Yabot\Slack\Client)
Open

    public function __construct(Client $client, LoggerInterface $log = null)
Severity: Minor
Found in src/Guzzle/Guzzle.php by phan

Return type of postAsync() is undeclared type \GuzzleHttp\Promise\PromiseInterface
Open

    public function postAsync(string $uri, array $options = [], callable $onRejected = null) : PromiseInterface
Severity: Minor
Found in src/Guzzle/Guzzle.php by phan

Expected 1 space after FUNCTION keyword; 0 found
Open

        $onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
Severity: Minor
Found in src/Guzzle/Guzzle.php by phpcodesniffer

Each PHP statement must be on a line by itself
Open

        $onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
Severity: Minor
Found in src/Guzzle/Guzzle.php by phpcodesniffer

Expected 1 space after FUNCTION keyword; 0 found
Open

        $onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
Severity: Minor
Found in src/Guzzle/Guzzle.php by phpcodesniffer

Each PHP statement must be on a line by itself
Open

        $onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
Severity: Minor
Found in src/Guzzle/Guzzle.php by phpcodesniffer

There must be one blank line after the namespace declaration
Open

namespace Nopolabs\Yabot\Guzzle;
Severity: Minor
Found in src/Guzzle/Guzzle.php by phpcodesniffer

Opening brace must be the last content on the line
Open

        $onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
Severity: Minor
Found in src/Guzzle/Guzzle.php by phpcodesniffer

Expected 1 newline at end of file; 0 found
Open

}
Severity: Minor
Found in src/Guzzle/Guzzle.php by phpcodesniffer

Closing brace must be on a line by itself
Open

        $onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
Severity: Minor
Found in src/Guzzle/Guzzle.php by phpcodesniffer

Closing brace must be on a line by itself
Open

        $onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
Severity: Minor
Found in src/Guzzle/Guzzle.php by phpcodesniffer

Opening brace must be the last content on the line
Open

        $onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
Severity: Minor
Found in src/Guzzle/Guzzle.php by phpcodesniffer

There are no issues that match your filters.

Category
Status