Passed
Push — master ( 5379a4...a2888f )
by Joao
04:49
created

src/Enum/FixedTextDefinition.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace ByJG\AnyDataset\Enum;
4
5
/**
6
 * @package xmlnuke
7
 */
8
class FixedTextDefinition
9
{
10
11
    public $fieldName;
12
    public $startPos;
13
    public $length;
14
    public $requiredValue;
15
    public $subTypes = array();
16
17
    /**
18
     *
19
     * @param string $fieldName
20
     * @param int $startPos
21
     * @param int $length
22
     * @param bool|string $requiredValue
23
     * @param FixedTextDefinition[] $subTypes
24
     */
25
    public function __construct($fieldName, $startPos, $length, $requiredValue = "", $subTypes = null)
26
    {
27
        $this->fieldName = $fieldName;
28
        $this->startPos = $startPos;
29
        $this->length = $length;
30
        $this->requiredValue = $requiredValue;
31
        $this->subTypes = $subTypes;
0 ignored issues
show
Documentation Bug introduced by
It seems like $subTypes can be null. However, the property $subTypes 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...
32
    }
33
}
34