Issues (5)

src/ARBCreateSubscriptionRequest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace CommerceGuys\AuthNet;
4
5
use GuzzleHttp\Client;
6
use CommerceGuys\AuthNet\DataTypes\Subscription;
7
use CommerceGuys\AuthNet\Request\RequestInterface;
8
9
/**
10
 * Use this method to create subscriptions using Automated Recurring Billing.
11
 */
12
class ARBCreateSubscriptionRequest extends ARBSubscriptionRequest
13
{
14
    protected $subscription;
15
16 1
    public function __construct(
17
        Configuration $configuration,
18
        Client $client,
19
        Subscription $subscription = null
20
    ) {
21 1
        parent::__construct($configuration, $client);
22 1
        $this->subscription = $subscription;
23 1
    }
24
25
    /**
26
     * @param \CommerceGuys\AuthNet\DataTypes\Subscription $subscription
27
     * @return $this
28
     */
29 1
    public function setSubscription(Subscription $subscription)
30
    {
31 1
        $this->subscription = $subscription;
32 1
        return $this;
33
    }
34
35 1
    protected function attachData(RequestInterface $request)
36 1
    {
37 1
        $request->addDataType($this->subscription);
0 ignored issues
show
It seems like $this->subscription can also be of type null; however, parameter $data of CommerceGuys\AuthNet\Req...nterface::addDataType() does only seem to accept CommerceGuys\AuthNet\DataTypes\DataTypeInterface, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

37
        $request->addDataType(/** @scrutinizer ignore-type */ $this->subscription);
Loading history...
38 1
    }
39
}
40