Issues (453)

src/SoapTypes/ShippingLabels.php (1 issue)

1
<?php
2
3
/*
4
 * This file is part of PHP CS Fixer.
5
 *
6
 * (c) Fabien Potencier <[email protected]>
7
 *     Dariusz RumiƄski <[email protected]>
8
 *
9
 * This source file is subject to the MIT license that is bundled
10
 * with this source code in the file LICENSE.
11
 */
12
13
namespace Etrias\PaazlConnector\SoapTypes;
14
15
class ShippingLabels
16
{
17
    /**
18
     * @var ShippingLabel[]
19
     */
20
    protected $shippingLabel = [];
21
22
    /**
23
     * Constructor.
24
     *
25
     * @var ShippingLabel[]
26
     *
27
     * @param mixed $shippingLabel
28
     */
29
    public function __construct(array $shippingLabels)
30
    {
31
        $this->shippingLabel = $shippingLabels;
32
    }
33
34
    /**
35
     * @return ShippingLabel[]
36
     */
37
    public function getShippingLabels()
38
    {
39
        return $this->shippingLabel;
40
    }
41
42
    /**
43
     * @param ShippingLabel[] $shippingLabel
44
     * @param mixed           $shippingLabels
45
     *
46
     * @return $this
47
     */
48
    public function setShippingLabels($shippingLabels)
49
    {
50
        $this->shippingLabel = $shippingLabels;
0 ignored issues
show
Documentation Bug introduced by
$shippingLabels is of type mixed, but the property $shippingLabel was declared to be of type Etrias\PaazlConnector\SoapTypes\ShippingLabel[]. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
51
52
        return $this;
53
    }
54
}
55