Conditions | 3 |
Paths | 2 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
71 | public static function create(array $data) |
||
72 | { |
||
73 | $tones = []; |
||
74 | foreach ($data[static::KEY_TONES] as $tone) { |
||
75 | $tones[] = ToneScore::create($tone); |
||
76 | } |
||
77 | |||
78 | return new self( |
||
79 | $data[static::KEY_ID], |
||
80 | $data[static::KEY_TEXT], |
||
81 | $tones, |
||
82 | isset($data[static::KEY_ERROR]) ?: null |
||
|
|||
83 | ); |
||
84 | } |
||
85 | |||
118 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.