Completed
Push — 1.x ( 628e2a...818468 )
by Joel
03:56
created

ContainerCreateResult::setId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Docker\API\Model;
4
5
class ContainerCreateResult
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $id;
11
    /**
12
     * @var string[]
13
     */
14
    protected $warnings;
15
16
    /**
17
     * @return string
18
     */
19
    public function getId()
20
    {
21
        return $this->id;
22
    }
23
24
    /**
25
     * @param string $id
26
     *
27
     * @return self
28
     */
29
    public function setId($id = null)
30
    {
31
        $this->id = $id;
32
33
        return $this;
34
    }
35
36
    /**
37
     * @return string[]
38
     */
39
    public function getWarnings()
40
    {
41
        return $this->warnings;
42
    }
43
44
    /**
45
     * @param string[] $warnings
46
     *
47
     * @return self
48
     */
49
    public function setWarnings(array $warnings = null)
50
    {
51
        $this->warnings = $warnings;
0 ignored issues
show
Documentation Bug introduced by
It seems like $warnings can be null. However, the property $warnings is declared as array. Maybe change the type of the property to array|null or add a type check?

Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.

To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.

function aContainsB(array $needle = null, array  $haystack) {
    if (!$needle) {
        return false;
    }

    return array_intersect($haystack, $needle) == $haystack;
}

The function can be called with either null or an array for the parameter $needle but will only accept an array as $haystack.

Loading history...
52
53
        return $this;
54
    }
55
}
56