Passed
Push — feature/paypal-express ( be9f92...d19b14 )
by Volodymyr
05:26
created

PaypalResponseProcessor::successResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SprykerEco\Yves\Braintree\Processor;
4
5
use Generated\Shared\Transfer\PaypalExpressSuccessResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...SuccessResponseTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use SprykerEco\Yves\Braintree\Mapper\PaypalResponse\PaypalResponseMapperInterface;
7
8
class PaypalResponseProcessor implements PaypalResponseProcessorInterface
9
{
10
    /**
11
     * @var PaypalResponseMapperInterface
12
     */
13
    protected $paypalResponseMapper;
14
15
    /**
16
     * @param PaypalResponseMapperInterface $paypalResponseMapper
17
     */
18
    public function __construct(
19
        PaypalResponseMapperInterface $paypalResponseMapper
20
    ) {
21
        $this->paypalResponseMapper = $paypalResponseMapper;
22
    }
23
24
    /**
25
     * @param array $payload
26
     *
27
     * @return PaypalExpressSuccessResponseTransfer
28
     */
29
    public function successResponse(array $payload): PaypalExpressSuccessResponseTransfer
30
    {
31
        $responseTransfer = $this->paypalResponseMapper->mapSuccessResponse($payload);
0 ignored issues
show
Unused Code introduced by
The assignment to $responseTransfer is dead and can be removed.
Loading history...
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return Generated\Shared\Transfe...SuccessResponseTransfer. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
32
    }
33
}