Completed
Push — master ( 4a8227...2407ef )
by Bukashk0zzz
01:29
created

Delivery::getOrderBefore()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Bukashk0zzzYmlGenerator
5
 *
6
 * (c) Denis Golubovskiy <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Bukashk0zzz\YmlGenerator\Model;
13
14
/**
15
 * Class Delivery
16
 */
17
class Delivery
18
{
19
    /**
20
     * @var int
21
     */
22
    private $cost;
23
24
    /**
25
     * @var int
26
     */
27
    private $days;
28
29
    /**
30
     * @var int
31
     */
32
    private $orderBefore;
33
34
    /**
35
     * @return int
36
     */
37
    public function getCost()
38
    {
39
        return $this->cost;
40
    }
41
42
    /**
43
     * @param int $cost
44
     * @return Delivery
45
     */
46
    public function setCost($cost)
47
    {
48
        $this->cost = $cost;
49
50
        return $this;
51
    }
52
53
    /**
54
     * @return int
55
     */
56
    public function getDays()
57
    {
58
        return $this->days;
59
    }
60
61
    /**
62
     * @param int $days
63
     * @return Delivery
64
     */
65
    public function setDays($days)
66
    {
67
        $this->days = $days;
68
69
        return $this;
70
    }
71
72
    /**
73
     * @return string|null
74
     */
75
    public function getOrderBefore()
76
    {
77
        return $this->orderBefore;
78
    }
79
80
    /**
81
     * @param string|null $orderBefore
82
     *
83
     * @return Delivery
84
     */
85
    public function setOrderBefore($orderBefore)
86
    {
87
        $this->orderBefore = $orderBefore;
0 ignored issues
show
Documentation Bug introduced by
It seems like $orderBefore can also be of type string. However, the property $orderBefore is declared as type integer. Maybe add an additional type 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 mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
88
89
        return $this;
90
    }
91
}
92