Issues (341)

src/XMLSchema/XML/AbstractNoFixedFacet.php (3 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSchema\XML;
6
7
use DOMElement;
8
use SimpleSAML\XML\Assert\Assert;
9
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
10
use SimpleSAML\XMLSchema\Exception\TooManyElementsException;
11
use SimpleSAML\XMLSchema\Type\IDValue;
0 ignored issues
show
The type SimpleSAML\XMLSchema\Type\IDValue was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface;
13
use SimpleSAML\XMLSchema\Type\StringValue;
0 ignored issues
show
The type SimpleSAML\XMLSchema\Type\StringValue was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
15
use function array_pop;
16
17
/**
18
 * Abstract class representing the facet-type.
19
 *
20
 * @package simplesamlphp/xml-common
21
 */
22
abstract class AbstractNoFixedFacet extends AbstractFacet
23
{
24
    /**
25
     * NoFixedFacet constructor
26
     *
27
     * @param \SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface $value
28
     * @param \SimpleSAML\XMLSchema\XML\Annotation|null $annotation
29
     * @param \SimpleSAML\XMLSchema\Type\IDValue|null $id
30
     * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
31
     */
32
    final public function __construct(
33
        ValueTypeInterface $value,
34
        ?Annotation $annotation = null,
0 ignored issues
show
The type SimpleSAML\XMLSchema\XML\Annotation was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
35
        ?IDValue $id = null,
36
        array $namespacedAttributes = [],
37
    ) {
38
        parent::__construct($value, null, $annotation, $id, $namespacedAttributes);
39
    }
40
41
42
    /**
43
     * Create an instance of this object from its XML representation.
44
     *
45
     * @param \DOMElement $xml
46
     * @return static
47
     *
48
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
49
     *   if the qualified name of the supplied element is wrong
50
     */
51
    public static function fromXML(DOMElement $xml): static
52
    {
53
        Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
54
        Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
55
56
        $annotation = Annotation::getChildrenOfClass($xml);
57
        Assert::maxCount($annotation, 1, TooManyElementsException::class);
58
59
        return new static(
60
            self::getAttribute($xml, 'value', StringValue::class),
61
            array_pop($annotation),
62
            self::getOptionalAttribute($xml, 'id', IDValue::class, null),
63
            self::getAttributesNSFromXML($xml),
64
        );
65
    }
66
}
67