Issues (456)

Form/DataProvider/PrepaymentDataProvider.php (6 issues)

1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Yves\Ratepay\Form\DataProvider;
9
10
use Generated\Shared\Transfer\PaymentTransfer;
0 ignored issues
show
The type Generated\Shared\Transfer\PaymentTransfer 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...
11
use Generated\Shared\Transfer\RatepayPaymentPrepaymentTransfer;
0 ignored issues
show
The type Generated\Shared\Transfe...ymentPrepaymentTransfer 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...
12
use Spryker\Shared\Kernel\Transfer\AbstractTransfer;
13
14
class PrepaymentDataProvider extends DataProviderAbstract
15
{
16
    /**
17
     * @param \Spryker\Shared\Kernel\Transfer\AbstractTransfer|\Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
0 ignored issues
show
The type Generated\Shared\Transfer\QuoteTransfer 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...
18
     *
19
     * @return \Spryker\Shared\Kernel\Transfer\AbstractTransfer|\Generated\Shared\Transfer\QuoteTransfer
20
     */
21
    public function getData(AbstractTransfer $quoteTransfer)
22
    {
23
        if ($quoteTransfer->getPayment() === null) {
0 ignored issues
show
The method getPayment() does not exist on Spryker\Shared\Kernel\Transfer\AbstractTransfer. ( Ignorable by Annotation )

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

23
        if ($quoteTransfer->/** @scrutinizer ignore-call */ getPayment() === null) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
24
            $paymentTransfer = new PaymentTransfer();
25
            $paymentMethodTransfer = new RatepayPaymentPrepaymentTransfer();
26
            $paymentMethodTransfer->setPhone($this->getPhoneNumber($quoteTransfer));
27
            $paymentTransfer->setRatepayPrepayment($paymentMethodTransfer);
28
29
            $quoteTransfer->setPayment($paymentTransfer);
0 ignored issues
show
The method setPayment() does not exist on Spryker\Shared\Kernel\Transfer\AbstractTransfer. ( Ignorable by Annotation )

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

29
            $quoteTransfer->/** @scrutinizer ignore-call */ 
30
                            setPayment($paymentTransfer);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
        }
31
32
        return $quoteTransfer;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $quoteTransfer returns the type Spryker\Shared\Kernel\Transfer\AbstractTransfer which is incompatible with the return type mandated by Spryker\Yves\StepEngine\...derInterface::getData() of Generated\Shared\Transfer\QuoteTransfer.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
33
    }
34
}
35