Failed Conditions
Push — modify-scrutinizeryml ( 361e25...08b4c1 )
by Kentaro
63:54 queued 57:30
created

DragAndDropBy::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 4
dl 0
loc 22
rs 9.568
c 0
b 0
f 0
1
<?php
2
3
4
namespace Interactions;
5
6
7
use Facebook\WebDriver\Interactions\Internal\WebDriverButtonReleaseAction;
8
use Facebook\WebDriver\Interactions\Internal\WebDriverClickAndHoldAction;
9
use Facebook\WebDriver\Interactions\Internal\WebDriverMoveToOffsetAction;
10
use Facebook\WebDriver\Interactions\WebDriverActions;
11
use Facebook\WebDriver\WebDriver;
12
13
class DragAndDropBy extends WebDriverActions
14
{
15
    /**
16
     * @param \Facebook\WebDriver\Remote\RemoteWebElement $source
17
     */
18
    public function __construct(WebDriver $driver, $source, $x_offset, $y_offset)
19
    {
20
        parent::__construct($driver);
0 ignored issues
show
Documentation introduced by
$driver is of type object<Facebook\WebDriver\WebDriver>, but the function expects a object<Facebook\WebDrive...bDriverHasInputDevices>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
21
        $this->action->addAction(
22
            new WebDriverClickAndHoldAction($this->mouse, $source)
23
        );
24
        $this->action->addAction(
25
            new WaitAction(1)
26
        );
27
        $this->action->addAction(
28
            new WebDriverMoveToOffsetAction($this->mouse, null, $x_offset, $y_offset)
29
        );
30
        $this->action->addAction(
31
            new WaitAction(1)
32
        );
33
        $this->action->addAction(
34
            new WebDriverButtonReleaseAction($this->mouse, null)
35
        );
36
        $this->action->addAction(
37
            new WaitAction(1)
38
        );
39
    }
40
}