netglue/prismic-php-kit

View on GitHub
src/Prismic/Exception/RequestFailureException.php

Summary

Maintainability
A
0 mins
Test Coverage
A
93%

Checking instanceof against undeclared class \GuzzleHttp\Exception\RequestException
Open

        if ($e instanceof RequestException) {

Checking instanceof against undeclared class \GuzzleHttp\Exception\RequestException
Open

        if (! $this->guzzleException instanceof RequestException) {

Return type of getRequest() is undeclared type ?\Psr\Http\Message\RequestInterface
Open

    public function getRequest() :? RequestInterface

Call to method getResponse from undeclared class \GuzzleHttp\Exception\RequestException
Open

        $response = $e->getResponse();

Argument 3 (previous) is \GuzzleHttp\Exception\GuzzleException but \Prismic\Exception\RequestFailureException::__construct() takes ?\RuntimeException|?\Throwable
Open

        $exception = new static('Api Request Failed', 500, $e);

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

    public function getResponse() :? ResponseInterface

Assigning \GuzzleHttp\Exception\RequestException to property but \Prismic\Exception\RequestFailureException->guzzleException is \GuzzleHttp\Exception\GuzzleException|null
Open

        $exception->guzzleException = $e;

Argument 3 (previous) is \GuzzleHttp\Exception\RequestException but \Prismic\Exception\RequestFailureException::__construct() takes ?\RuntimeException|?\Throwable
Open

        $exception = new static($message, $code, $e);

Parameter $e has undeclared type \GuzzleHttp\Exception\RequestException
Open

    protected static function fromGuzzleRequestException(RequestException $e) : self

Call to method getRequest from undeclared class \GuzzleHttp\Exception\RequestException
Open

        $request  = $e->getRequest();

Property \Prismic\Exception\RequestFailureException->guzzleException has undeclared type \GuzzleHttp\Exception\GuzzleException
Open

    protected $guzzleException;

Call to method getRequest from undeclared class \GuzzleHttp\Exception\GuzzleException
Open

        return $this->guzzleException->getRequest();

Call to method getResponse from undeclared class \GuzzleHttp\Exception\GuzzleException
Open

        return $this->guzzleException->getResponse();

Checking instanceof against undeclared class \GuzzleHttp\Exception\RequestException
Open

        if (! $this->guzzleException instanceof RequestException) {

Parameter $e has undeclared type \GuzzleHttp\Exception\GuzzleException
Open

    public static function fromGuzzleException(GuzzleException $e) : self

Avoid variables with short names like $e. Configured minimum length is 3.
Open

    protected static function fromGuzzleRequestException(RequestException $e) : self

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $e. Configured minimum length is 3.
Open

    public static function fromGuzzleException(GuzzleException $e) : self

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

There are no issues that match your filters.

Category
Status