88use SimpleSAML \Assert \Assert ;
99use SimpleSAML \XML \AbstractElement ;
1010use SimpleSAML \XML \Exception \InvalidDOMElementException ;
11- use SimpleSAML \XML \Type \{BooleanValue , IntegerValue , StringValue };
11+ use SimpleSAML \XML \Type \{BooleanValue , IntegerValue , StringValue , ValueTypeInterface };
1212
1313use function strval ;
1414
@@ -27,26 +27,26 @@ final class Element extends AbstractElement
2727
2828
2929 /**
30- * @param \SimpleSAML\XML\Type\IntegerValue|null $integer
31- * @param \SimpleSAML\XML\Type\BooleanValue|null $boolean
32- * @param \SimpleSAML\XML\Type\StringValue|null $text
33- * @param \SimpleSAML\XML\Type\StringValue|null $otherText
30+ * @param \SimpleSAML\XML\Type\IntegerValue $integer
31+ * @param \SimpleSAML\XML\Type\BooleanValue $boolean
32+ * @param \SimpleSAML\XML\Type\StringValue $text
33+ * @param \SimpleSAML\XML\Type\StringValue $otherText
3434 */
3535 public function __construct (
36- protected ? IntegerValue $ integer = null ,
37- protected ? BooleanValue $ boolean = null ,
38- protected ? StringValue $ text = null ,
39- protected ? StringValue $ otherText = null ,
36+ protected IntegerValue $ integer ,
37+ protected BooleanValue $ boolean ,
38+ protected StringValue $ text ,
39+ protected StringValue $ otherText ,
4040 ) {
4141 }
4242
4343
4444 /**
4545 * Collect the value of the integer-property
4646 *
47- * @return \SimpleSAML\XML\Type\IntegerValue|null
47+ * @return \SimpleSAML\XML\Type\IntegerValue
4848 */
49- public function getInteger (): ? IntegerValue
49+ public function getInteger (): IntegerValue
5050 {
5151 return $ this ->integer ;
5252 }
@@ -55,9 +55,9 @@ public function getInteger(): ?IntegerValue
5555 /**
5656 * Collect the value of the boolean-property
5757 *
58- * @return \SimpleSAML\XML\Type\BooleanValue|null
58+ * @return \SimpleSAML\XML\Type\BooleanValue
5959 */
60- public function getBoolean (): ? BooleanValue
60+ public function getBoolean (): BooleanValue
6161 {
6262 return $ this ->boolean ;
6363 }
@@ -66,20 +66,20 @@ public function getBoolean(): ?BooleanValue
6666 /**
6767 * Collect the value of the text-property
6868 *
69- * @return \SimpleSAML\XML\Type\StringValue|null
69+ * @return \SimpleSAML\XML\Type\StringValue
7070 */
71- public function getString (): ? StringValue
71+ public function getString (): StringValue
7272 {
7373 return $ this ->text ;
7474 }
7575
7676
7777 /**
78- * Collect the value of the text2 -property
78+ * Collect the value of the otherText -property
7979 *
80- * @return \SimpleSAML\XML\Type\StringValue|null
80+ * @return \SimpleSAML\XML\Type\StringValue
8181 */
82- public function getOtherString (): ? StringValue
82+ public function getOtherString (): StringValue
8383 {
8484 return $ this ->otherText ;
8585 }
@@ -115,21 +115,10 @@ public function toXML(?DOMElement $parent = null): DOMElement
115115 {
116116 $ e = $ this ->instantiateParentElement ($ parent );
117117
118- if ($ this ->getInteger () !== null ) {
119- $ e ->setAttribute ('integer ' , $ this ->getInteger ());
120- }
121-
122- if ($ this ->getBoolean () !== null ) {
123- $ e ->setAttribute ('boolean ' , strval ($ this ->getBoolean ()));
124- }
125-
126- if ($ this ->getString () !== null ) {
127- $ e ->setAttribute ('text ' , strval ($ this ->getString ()));
128- }
129-
130- if ($ this ->getOtherString () !== null ) {
131- $ e ->setAttribute ('otherText ' , strval ($ this ->getOtherString ()));
132- }
118+ $ e ->setAttribute ('integer ' , strval ($ this ->getInteger ()));
119+ $ e ->setAttribute ('boolean ' , strval ($ this ->getBoolean ()));
120+ $ e ->setAttribute ('text ' , strval ($ this ->getString ()));
121+ $ e ->setAttribute ('otherText ' , strval ($ this ->getOtherString ()));
133122
134123 return $ e ;
135124 }
0 commit comments