Skip to content

Commit 181a115

Browse files
committed
Replace array_pop with array_last
1 parent 284afbd commit 181a115

46 files changed

Lines changed: 116 additions & 100 deletions

Some content is hidden

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

src/XML/SerializableElementTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use DOMElement;
88
use SimpleSAML\XML\DOMDocumentFactory;
99

10-
use function array_pop;
10+
use function array_last;
1111
use function get_object_vars;
1212

1313
/**
@@ -73,7 +73,7 @@ public function __serialize(): array
7373
public function __unserialize(array $serialized): void
7474
{
7575
$xml = static::fromXML(
76-
DOMDocumentFactory::fromString(array_pop($serialized))->documentElement,
76+
DOMDocumentFactory::fromString(array_last($serialized))->documentElement,
7777
);
7878

7979
$vars = get_object_vars($xml);

src/XMLSchema/XML/AbstractNoFixedFacet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface;
1313
use SimpleSAML\XMLSchema\Type\StringValue;
1414

15-
use function array_pop;
15+
use function array_last;
1616

1717
/**
1818
* Abstract class representing the facet-type.
@@ -58,7 +58,7 @@ public static function fromXML(DOMElement $xml): static
5858

5959
return new static(
6060
self::getAttribute($xml, 'value', StringValue::class),
61-
array_pop($annotation),
61+
array_last($annotation),
6262
self::getOptionalAttribute($xml, 'id', IDValue::class, null),
6363
self::getAttributesNSFromXML($xml),
6464
);

src/XMLSchema/XML/AbstractNumFacet.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use SimpleSAML\XMLSchema\Type\Interface\ValueTypeInterface;
1414
use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue;
1515

16+
use function array_last;
17+
1618
/**
1719
* Abstract class representing the facet-type.
1820
*
@@ -62,7 +64,7 @@ public static function fromXML(DOMElement $xml): static
6264
return new static(
6365
self::getAttribute($xml, 'value', NonNegativeIntegerValue::class),
6466
self::getOptionalAttribute($xml, 'fixed', BooleanValue::class, null),
65-
array_pop($annotation),
67+
array_last($annotation),
6668
self::getOptionalAttribute($xml, 'id', IDValue::class, null),
6769
self::getAttributesNSFromXML($xml),
6870
);

src/XMLSchema/XML/All.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use SimpleSAML\XMLSchema\XML\Interface\ParticleInterface;
2020
use SimpleSAML\XMLSchema\XML\Interface\TypeDefParticleInterface;
2121

22-
use function array_pop;
22+
use function array_last;
2323

2424
/**
2525
* Class representing the all-element.
@@ -69,7 +69,7 @@ public static function fromXML(DOMElement $xml): static
6969
self::getOptionalAttribute($xml, 'minCount', MinOccursValue::class, null),
7070
self::getOptionalAttribute($xml, 'maxCount', MaxOccursValue::class, null),
7171
$narrowMaxMin,
72-
annotation: array_pop($annotation),
72+
annotation: array_last($annotation),
7373
id: self::getOptionalAttribute($xml, 'id', IDValue::class, null),
7474
namespacedAttributes: self::getAttributesNSFromXML($xml),
7575
);

src/XMLSchema/XML/Any.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use SimpleSAML\XMLSchema\XML\Interface\NestedParticleInterface;
1919
use SimpleSAML\XMLSchema\XML\Trait\OccursTrait;
2020

21-
use function array_pop;
21+
use function array_last;
2222
use function strval;
2323

2424
/**
@@ -97,7 +97,7 @@ public static function fromXML(DOMElement $xml): static
9797
return new static(
9898
self::getOptionalAttribute($xml, 'namespace', NamespaceListValue::class, null),
9999
self::getOptionalAttribute($xml, 'processContents', ProcessContentsValue::class, null),
100-
array_pop($annotation),
100+
array_last($annotation),
101101
self::getOptionalAttribute($xml, 'id', IDValue::class, null),
102102
self::getAttributesNSFromXML($xml),
103103
self::getOptionalAttribute($xml, 'minOccurs', MinOccursValue::class, null),

src/XMLSchema/XML/AnyAttribute.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use SimpleSAML\XMLSchema\Type\Schema\NamespaceListValue;
1515
use SimpleSAML\XMLSchema\Type\Schema\ProcessContentsValue;
1616

17-
use function array_pop;
17+
use function array_last;
1818

1919
/**
2020
* Class representing the anyAttribute element
@@ -49,7 +49,7 @@ public static function fromXML(DOMElement $xml): static
4949
return new static(
5050
self::getOptionalAttribute($xml, 'namespace', NamespaceListValue::class, null),
5151
self::getOptionalAttribute($xml, 'processContents', ProcessContentsValue::class, null),
52-
array_pop($annotation),
52+
array_last($annotation),
5353
self::getOptionalAttribute($xml, 'id', IDValue::class, null),
5454
self::getAttributesNSFromXML($xml),
5555
);

src/XMLSchema/XML/Choice.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use SimpleSAML\XMLSchema\XML\Interface\TypeDefParticleInterface;
2121

2222
use function array_merge;
23-
use function array_pop;
23+
use function array_last;
2424

2525
/**
2626
* Class representing the choice-element.
@@ -74,7 +74,7 @@ public static function fromXML(DOMElement $xml): static
7474
self::getOptionalAttribute($xml, 'minOccurs', MinOccursValue::class, null),
7575
self::getOptionalAttribute($xml, 'maxOccurs', MaxOccursValue::class, null),
7676
$particles,
77-
array_pop($annotation),
77+
array_last($annotation),
7878
self::getOptionalAttribute($xml, 'id', IDValue::class, null),
7979
self::getAttributesNSFromXML($xml),
8080
);

src/XMLSchema/XML/ComplexContent.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use SimpleSAML\XMLSchema\Type\BooleanValue;
1414
use SimpleSAML\XMLSchema\Type\IDValue;
1515

16+
use function array_last;
1617
use function array_merge;
1718
use function strval;
1819

@@ -131,7 +132,7 @@ public static function fromXML(DOMElement $xml): static
131132
return new static(
132133
$content[0],
133134
self::getOptionalAttribute($xml, 'mixed', BooleanValue::class, null),
134-
array_pop($annotation),
135+
array_last($annotation),
135136
self::getOptionalAttribute($xml, 'id', IDValue::class, null),
136137
self::getAttributesNSFromXML($xml),
137138
);

src/XMLSchema/XML/ComplexRestriction.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
use SimpleSAML\XMLSchema\Type\IDValue;
1212
use SimpleSAML\XMLSchema\Type\QNameValue;
1313

14+
use function array_last;
1415
use function array_merge;
15-
use function array_pop;
1616

1717
/**
1818
* Class representing the complexRestrictionType restriction-element.
@@ -65,10 +65,10 @@ public static function fromXML(DOMElement $xml): static
6565

6666
return new static(
6767
self::getAttribute($xml, 'base', QNameValue::class),
68-
array_pop($particles),
68+
array_last($particles),
6969
$attributes,
70-
array_pop($anyAttribute),
71-
array_pop($annotation),
70+
array_last($anyAttribute),
71+
array_last($annotation),
7272
self::getOptionalAttribute($xml, 'id', IDValue::class, null),
7373
self::getAttributesNSFromXML($xml),
7474
);

src/XMLSchema/XML/Extension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
use SimpleSAML\XMLSchema\Type\IDValue;
1212
use SimpleSAML\XMLSchema\Type\QNameValue;
1313

14+
use function array_last;
1415
use function array_merge;
15-
use function array_pop;
1616

1717
/**
1818
* Class representing the local version of xs:extension.
@@ -65,10 +65,10 @@ public static function fromXML(DOMElement $xml): static
6565

6666
return new static(
6767
self::getAttribute($xml, 'base', QNameValue::class),
68-
array_pop($particles),
68+
array_last($particles),
6969
$attributes,
70-
array_pop($anyAttribute),
71-
array_pop($annotation),
70+
array_last($anyAttribute),
71+
array_last($annotation),
7272
self::getOptionalAttribute($xml, 'id', IDValue::class, null),
7373
self::getAttributesNSFromXML($xml),
7474
);

0 commit comments

Comments
 (0)