Skip to content

Commit a321966

Browse files
committed
Replace array_pop with array_last
1 parent d99f764 commit a321966

32 files changed

Lines changed: 111 additions & 105 deletions

src/XML/ds/AbstractDSAKeyValueType.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
1414
use SimpleSAML\XMLSchema\Exception\TooManyElementsException;
1515

16-
use function array_pop;
16+
use function array_last;
1717

1818
/**
1919
* A class implementing the ds:AbstractDSAKeyValueType element.
@@ -177,13 +177,13 @@ public static function fromXML(DOMElement $xml): static
177177
Assert::maxCount($pgenCounter, 1, TooManyElementsException::class);
178178

179179
return new static(
180-
array_pop($y),
181-
array_pop($g),
182-
array_pop($j),
183-
array_pop($p),
184-
array_pop($q),
185-
array_pop($seed),
186-
array_pop($pgenCounter),
180+
array_last($y),
181+
array_last($g),
182+
array_last($j),
183+
array_last($p),
184+
array_last($q),
185+
array_last($seed),
186+
array_last($pgenCounter),
187187
);
188188
}
189189

src/XML/ds/AbstractPGPDataType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use SimpleSAML\XMLSchema\XML\Constants\NS;
1616
use SimpleSAML\XMLSecurity\XML\ds\AbstractDsElement;
1717

18-
use function array_pop;
18+
use function array_last;
1919

2020
/**
2121
* Abstract class representing the PGPDataType.
@@ -95,8 +95,8 @@ public static function fromXML(DOMElement $xml): static
9595
Assert::maxCount($pgpKeyPacket, 1, TooManyElementsException::class);
9696

9797
return new static(
98-
array_pop($pgpKeyId),
99-
array_pop($pgpKeyPacket),
98+
array_last($pgpKeyId),
99+
array_last($pgpKeyPacket),
100100
self::getChildElementsFromXML($xml),
101101
);
102102
}

src/XML/ds/KeyValue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
use SimpleSAML\XMLSecurity\Constants as C;
1919
use SimpleSAML\XMLSecurity\XML\dsig11\ECKeyValue;
2020

21+
use function array_last;
2122
use function array_merge;
22-
use function array_pop;
2323

2424
/**
2525
* Class representing a ds:KeyValue element.
@@ -107,7 +107,7 @@ public static function fromXML(DOMElement $xml): static
107107
TooManyElementsException::class,
108108
);
109109

110-
return new static(array_pop($keyValue));
110+
return new static(array_last($keyValue));
111111
}
112112

113113

src/XML/ds/RSAKeyValue.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use SimpleSAML\XMLSchema\Exception\MissingElementException;
1313
use SimpleSAML\XMLSchema\Exception\TooManyElementsException;
1414

15+
use function array_last;
16+
1517
/**
1618
* Class representing a ds:RSAKeyValue element.
1719
*
@@ -98,7 +100,7 @@ public static function fromXML(DOMElement $xml): static
98100
TooManyElementsException::class,
99101
);
100102

101-
return new static(array_pop($modulus), array_pop($exponent));
103+
return new static(array_last($modulus), array_last($exponent));
102104
}
103105

104106

src/XML/ds/Reference.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use SimpleSAML\XMLSchema\Type\IDValue;
1515
use SimpleSAML\XMLSecurity\Assert\Assert;
1616

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

2020
/**
@@ -153,9 +153,9 @@ public static function fromXML(DOMElement $xml): static
153153
);
154154

155155
return new static(
156-
array_pop($digestMethod),
157-
array_pop($digestValue),
158-
empty($transforms) ? null : array_pop($transforms),
156+
array_last($digestMethod),
157+
array_last($digestValue),
158+
empty($transforms) ? null : array_last($transforms),
159159
$Id,
160160
$Type,
161161
$URI,

src/XML/ds/RetrievalMethod.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use SimpleSAML\XMLSchema\Exception\TooManyElementsException;
1313
use SimpleSAML\XMLSchema\Type\AnyURIValue;
1414

15+
use function array_last;
1516
use function strval;
1617

1718
/**
@@ -91,7 +92,7 @@ public static function fromXML(DOMElement $xml): static
9192
);
9293

9394
return new static(
94-
array_pop($transforms),
95+
array_last($transforms),
9596
$URI,
9697
$Type,
9798
);

src/XML/ds/Signature.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use SimpleSAML\XMLSecurity\Assert\Assert;
1515
use SimpleSAML\XMLSecurity\Constants as C;
1616

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

2020
/**
@@ -149,9 +149,9 @@ public static function fromXML(DOMElement $xml): static
149149
$objects = DsObject::getChildrenOfClass($xml);
150150

151151
return new static(
152-
array_pop($signedInfo),
153-
array_pop($signatureValue),
154-
empty($keyInfo) ? null : array_pop($keyInfo),
152+
array_last($signedInfo),
153+
array_last($signatureValue),
154+
empty($keyInfo) ? null : array_last($keyInfo),
155155
$objects,
156156
self::getOptionalAttribute($xml, 'Id', IDValue::class, null),
157157
);

src/XML/ds/SignatureMethod.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException;
1818

1919
use function array_keys;
20+
use function array_last;
2021
use function array_merge;
21-
use function array_pop;
2222
use function strval;
2323

2424
/**
@@ -102,7 +102,7 @@ public static function fromXML(DOMElement $xml): static
102102
$hmacOutputLength = HMACOutputLength::getChildrenOfClass($xml);
103103
Assert::maxCount($hmacOutputLength, 1, TooManyElementsException::class);
104104

105-
return new static($Algorithm, array_pop($hmacOutputLength), self::getChildElementsFromXML($xml));
105+
return new static($Algorithm, array_last($hmacOutputLength), self::getChildElementsFromXML($xml));
106106
}
107107

108108

src/XML/ds/SignedInfo.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use SimpleSAML\XMLSecurity\XML\CanonicalizableElementInterface;
1818
use SimpleSAML\XMLSecurity\XML\CanonicalizableElementTrait;
1919

20-
use function array_pop;
20+
use function array_last;
2121
use function strval;
2222

2323
/**
@@ -162,8 +162,8 @@ public static function fromXML(DOMElement $xml): static
162162
);
163163

164164
$signedInfo = new static(
165-
array_pop($canonicalizationMethod),
166-
array_pop($signatureMethod),
165+
array_last($canonicalizationMethod),
166+
array_last($signatureMethod),
167167
$references,
168168
self::getOptionalAttribute($xml, 'Id', IDValue::class, null),
169169
);

src/XML/ds/Transform.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use SimpleSAML\XMLSecurity\XML\ec\InclusiveNamespaces;
1616
use SimpleSAML\XPath\Constants as XPATH_C;
1717

18-
use function array_pop;
18+
use function array_last;
1919
use function strval;
2020

2121
/**
@@ -121,8 +121,8 @@ public static function fromXML(DOMElement $xml): static
121121

122122
return new static(
123123
self::getAttribute($xml, 'Algorithm', AnyURIValue::class),
124-
array_pop($xpath),
125-
array_pop($prefixes),
124+
array_last($xpath),
125+
array_last($prefixes),
126126
);
127127
}
128128

0 commit comments

Comments
 (0)