Skip to content

Commit 75b8b5e

Browse files
committed
readonly properties
1 parent f4aaeeb commit 75b8b5e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+96
-95
lines changed

src/XML/ExtendableAttributesTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ trait ExtendableAttributesTrait
3434
*
3535
* @var array<int, \SimpleSAML\XML\Attribute>
3636
*/
37-
protected array $namespacedAttributes = [];
37+
protected readonly array $namespacedAttributes;
3838

3939

4040
/**

src/XML/ExtendableElementTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
trait ExtendableElementTrait
3030
{
3131
/** @var \SimpleSAML\XML\SerializableElementInterface[] */
32-
protected array $elements = [];
32+
protected readonly array $elements;
3333

3434

3535
/**

src/XMLSchema/XML/AbstractAnnotated.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ abstract class AbstractAnnotated extends AbstractOpenAttrs
2424
* @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
2525
*/
2626
public function __construct(
27-
protected ?Annotation $annotation = null,
28-
protected ?IDValue $id = null,
27+
protected readonly ?Annotation $annotation = null,
28+
protected readonly ?IDValue $id = null,
2929
array $namespacedAttributes = [],
3030
) {
3131
parent::__construct($namespacedAttributes);

src/XMLSchema/XML/AbstractAttribute.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ abstract class AbstractAttribute extends AbstractAnnotated
4545
* @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
4646
*/
4747
public function __construct(
48-
protected ?QNameValue $type = null,
48+
protected readonly ?QNameValue $type = null,
4949
?NCNameValue $name = null,
5050
?QNameValue $reference = null,
51-
protected ?UseValue $use = null,
52-
protected ?StringValue $default = null,
53-
protected ?StringValue $fixed = null,
51+
protected readonly ?UseValue $use = null,
52+
protected readonly ?StringValue $default = null,
53+
protected readonly ?StringValue $fixed = null,
5454
?FormChoiceValue $formChoice = null,
55-
protected ?LocalSimpleType $simpleType = null,
55+
protected readonly ?LocalSimpleType $simpleType = null,
5656
?Annotation $annotation = null,
5757
?IDValue $id = null,
5858
array $namespacedAttributes = [],

src/XMLSchema/XML/AbstractAttributeGroup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public function __construct(
4343
?AnyAttribute $anyAttribute = null,
4444
?NCNameValue $name = null,
4545
?QNameValue $reference = null,
46-
protected ?Annotation $annotation = null,
47-
protected ?IDValue $id = null,
46+
?Annotation $annotation = null,
47+
?IDValue $id = null,
4848
array $namespacedAttributes = [],
4949
) {
5050
parent::__construct($annotation, $id, $namespacedAttributes);

src/XMLSchema/XML/AbstractComplexType.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ abstract class AbstractComplexType extends AbstractAnnotated
4747
* @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
4848
*/
4949
public function __construct(
50-
protected ?NCNameValue $name = null,
51-
protected ?BooleanValue $mixed = null,
52-
protected ?BooleanValue $abstract = null,
53-
protected ?DerivationSetValue $final = null,
54-
protected ?DerivationSetValue $block = null,
50+
protected readonly ?NCNameValue $name = null,
51+
protected readonly ?BooleanValue $mixed = null,
52+
protected readonly ?BooleanValue $abstract = null,
53+
protected readonly ?DerivationSetValue $final = null,
54+
protected readonly ?DerivationSetValue $block = null,
5555
SimpleContent|ComplexContent|null $content = null,
5656
?TypeDefParticleInterface $particle = null,
5757
array $attributes = [],
@@ -73,6 +73,7 @@ public function __construct(
7373
} else {
7474
Assert::null($content, SchemaViolationException::class);
7575

76+
$this->setContent(null);
7677
$this->setParticle($particle);
7778
$this->setAttributes($attributes);
7879
$this->setAnyAttribute($anyAttribute);

src/XMLSchema/XML/AbstractElement.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@ abstract class AbstractElement extends AbstractAnnotated
6161
public function __construct(
6262
?NCNameValue $name = null,
6363
?QNameValue $reference = null,
64-
protected LocalSimpleType|LocalComplexType|null $localType = null,
65-
protected array $identityConstraint = [],
66-
protected ?QNameValue $type = null,
67-
protected ?QNameValue $substitutionGroup = null,
64+
protected readonly LocalSimpleType|LocalComplexType|null $localType = null,
65+
protected readonly array $identityConstraint = [],
66+
protected readonly ?QNameValue $type = null,
67+
protected readonly ?QNameValue $substitutionGroup = null,
6868
?MinOccursValue $minOccurs = null,
6969
?MaxOccursValue $maxOccurs = null,
70-
protected ?StringValue $default = null,
71-
protected ?StringValue $fixed = null,
72-
protected ?BooleanValue $nillable = null,
73-
protected ?BooleanValue $abstract = null,
74-
protected ?DerivationSetValue $final = null,
75-
protected ?BlockSetValue $block = null,
76-
protected ?FormChoiceValue $form = null,
70+
protected readonly ?StringValue $default = null,
71+
protected readonly ?StringValue $fixed = null,
72+
protected readonly ?BooleanValue $nillable = null,
73+
protected readonly ?BooleanValue $abstract = null,
74+
protected readonly ?DerivationSetValue $final = null,
75+
protected readonly ?BlockSetValue $block = null,
76+
protected readonly ?FormChoiceValue $form = null,
7777
?Annotation $annotation = null,
7878
?IDValue $id = null,
7979
array $namespacedAttributes = [],

src/XMLSchema/XML/AbstractExtensionType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ abstract class AbstractExtensionType extends AbstractAnnotated
3939
* @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
4040
*/
4141
public function __construct(
42-
protected QNameValue $base,
42+
protected readonly QNameValue $base,
4343
// xs:typeDefParticle
4444
?TypeDefParticleInterface $particle = null,
4545
// xs:attrDecls

src/XMLSchema/XML/AbstractFacet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ abstract class AbstractFacet extends AbstractAnnotated
2828
* @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
2929
*/
3030
public function __construct(
31-
protected ValueTypeInterface $value,
32-
protected ?BooleanValue $fixed = null,
31+
protected readonly ValueTypeInterface $value,
32+
protected readonly ?BooleanValue $fixed = null,
3333
?Annotation $annotation = null,
3434
?IDValue $id = null,
3535
array $namespacedAttributes = [],

src/XMLSchema/XML/AbstractGroup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(
4545
?QNameValue $reference = null,
4646
?MinOccursValue $minOccurs = null,
4747
?MaxOccursValue $maxOccurs = null,
48-
protected array $particles = [],
48+
protected readonly array $particles = [],
4949
?Annotation $annotation = null,
5050
?IDValue $id = null,
5151
array $namespacedAttributes = [],

0 commit comments

Comments
 (0)