Issues (133)

src/Bpost/Labels.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Bpost\BpostApiClient\Bpost;
4
5
use SimpleXMLElement;
6
7
/**
8
 * Class Labels
9
 */
10
class Labels
11
{
12
    /**
13
     * @param SimpleXMLElement $xml
14
     *
15
     * @return Label[]
16
     */
17
    public static function createFromXML(SimpleXMLElement $xml)
18
    {
19
        $labels = array();
20
21
        if (isset($xml->label)) {
22
            foreach ($xml->label as $label) {
23
                $labels[] = Label::createFromXML($label);
0 ignored issues
show
It seems like $label can also be of type null; however, parameter $xml of Bpost\BpostApiClient\Bpost\Label::createFromXML() does only seem to accept SimpleXMLElement, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

23
                $labels[] = Label::createFromXML(/** @scrutinizer ignore-type */ $label);
Loading history...
24
            }
25
        }
26
27
        return $labels;
28
    }
29
}
30