Skip to content

Commit 5af55b1

Browse files
committed
Fix codesniffer issues
1 parent 9682a8d commit 5af55b1

16 files changed

Lines changed: 71 additions & 44 deletions

src/TestUtils/PEMCertificatesMock.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ private static function stripHeaders(string $key, bool $private)
6161
*/
6262
public static function loadPlainCertificateFile(string $file, $sig_alg = self::ALG_SIG_RSA)
6363
{
64+
$base = dirname(dirname(dirname(__FILE__)));
6465
if ($sig_alg === self::ALG_SIG_RSA) {
65-
return file_get_contents(dirname(dirname(dirname(__FILE__))) . self::CERTIFICATE_DIR_RSA . DIRECTORY_SEPARATOR . $file);
66+
return file_get_contents($base . self::CERTIFICATE_DIR_RSA . DIRECTORY_SEPARATOR . $file);
6667
} else {
67-
return file_get_contents(dirname(dirname(dirname(__FILE__))) . self::CERTIFICATE_DIR_DSA . DIRECTORY_SEPARATOR . $file);
68+
return file_get_contents($base . self::CERTIFICATE_DIR_DSA . DIRECTORY_SEPARATOR . $file);
6869
}
6970
}
7071

src/Utils/Random.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ class Random
1919
*
2020
* @return string A random string of $length length.
2121
*
22-
* @throws \SimpleSAML\XMLSecurity\Exception\InvalidArgumentException If $length is not an integer greater than zero.
23-
* @throws \SimpleSAML\XMLSecurity\Exception\RuntimeException If no appropriate sources of cryptographically
24-
* secure random generators are available.
22+
* @throws \SimpleSAML\XMLSecurity\Exception\InvalidArgumentException
23+
* If $length is not an integer greater than zero.
24+
* @throws \SimpleSAML\XMLSecurity\Exception\RuntimeException
25+
* If no appropriate sources of cryptographically secure random generators are available.
2526
*/
2627
public static function generateRandomBytes(int $length): string
2728
{

src/XML/ds/KeyInfo.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ private function setInfo(array $info): void
120120
* @param \DOMElement $xml The XML element we should load
121121
* @return self
122122
*
123-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException if the qualified name of the supplied element is wrong
123+
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
124+
* If the qualified name of the supplied element is wrong
124125
*/
125126
public static function fromXML(DOMElement $xml): object
126127
{

src/XML/ds/KeyName.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ private function setName(string $name): void
6262
* @param \DOMElement $xml The XML element we should load
6363
* @return self
6464
*
65-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException if the qualified name of the supplied element is wrong
65+
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
66+
* If the qualified name of the supplied element is wrong
6667
*/
6768
public static function fromXML(DOMElement $xml): object
6869
{

src/XML/ds/Signature.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ public function getSigner(): XMLSecurityDSig
136136
* @return \SimpleSAML\XML\AbstractXMLElement
137137
* @throws \Exception
138138
*
139-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException if the qualified name of the supplied element is wrong
140-
* @throws \SimpleSAML\XML\Exception\MissingAttributeException if the supplied signature is missing an Algorithm attribute
139+
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
140+
* If the qualified name of the supplied element is wrong
141+
* @throws \SimpleSAML\XML\Exception\MissingAttributeException
142+
* If the supplied signature is missing an Algorithm attribute
141143
*/
142144
public static function fromXML(DOMElement $xml): object
143145
{

src/XML/ds/X509Certificate.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ private function setCertificate(string $certificate): void
6262
* @param \DOMElement $xml The XML element we should load
6363
* @return self
6464
*
65-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException if the qualified name of the supplied element is wrong
65+
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
66+
* If the qualified name of the supplied element is wrong
6667
*/
6768
public static function fromXML(DOMElement $xml): object
6869
{

src/XML/ds/X509Data.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ private function setData(array $data): void
7979
* @param \DOMElement $xml The XML element we should load
8080
* @return self
8181
*
82-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException if the qualified name of the supplied element is wrong
82+
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
83+
* If the qualified name of the supplied element is wrong
8384
*/
8485
public static function fromXML(DOMElement $xml): object
8586
{

src/XML/ds/X509SubjectName.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ private function setName(string $name): void
6262
* @param \DOMElement $xml The XML element we should load
6363
* @return self
6464
*
65-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException if the qualified name of the supplied element is wrong
65+
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
66+
* If the qualified name of the supplied element is wrong
6667
*/
6768
public static function fromXML(DOMElement $xml): object
6869
{

src/XML/xenc/AbstractEncryptedType.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ class AbstractEncryptedType extends AbstractXencElement
5050
* @param string|null $type The Type attribute of this object. Optional.
5151
* @param string|null $mimeType The MimeType attribute of this object. Optional.
5252
* @param string|null $encoding The Encoding attribute of this object. Optional.
53-
* @param \SimpleSAML\XMLSecurity\XML\xenc\EncryptionMethod|null $encryptionMethod The EncryptionMethod object of this EncryptedData. Optional.
53+
* @param \SimpleSAML\XMLSecurity\XML\xenc\EncryptionMethod|null $encryptionMethod
54+
* The EncryptionMethod object of this EncryptedData. Optional.
5455
* @param \SimpleSAML\XMLSecurity\XML\ds\KeyInfo|null $keyInfo The KeyInfo object of this EncryptedData. Optional.
5556
*/
5657
protected function __construct(
@@ -218,9 +219,12 @@ protected function setType(?string $type): void
218219
/**
219220
* @inheritDoc
220221
*
221-
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException if the qualified name of the supplied element is wrong
222-
* @throws \SimpleSAML\XML\Exception\MissingElementException if one of the mandatory child-elements is missing
223-
* @throws \SimpleSAML\XML\Exception\TooManyElementsException if too many child-elements of a type are specified
222+
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
223+
* If the qualified name of the supplied element is wrong
224+
* @throws \SimpleSAML\XML\Exception\MissingElementException
225+
* If one of the mandatory child-elements is missing
226+
* @throws \SimpleSAML\XML\Exception\TooManyElementsException
227+
* If too many child-elements of a type are specified
224228
*/
225229
public static function fromXML(DOMElement $xml): object
226230
{

src/XML/xenc/AbstractEncryptionMethod.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,22 @@ public static function fromXML(DOMElement $xml): object
8080
continue;
8181
} elseif ($node->namespaceURI === Constants::XMLENCNS) {
8282
if ($node->localName === 'KeySize') {
83-
Assert::null($keySize, $node->tagName . ' cannot be set more than once.', TooManyElementsException::class);
83+
Assert::null(
84+
$keySize,
85+
$node->tagName . ' cannot be set more than once.',
86+
TooManyElementsException::class
87+
);
8488
Assert::numeric($node->textContent, $node->tagName . ' must be numerical.');
8589
$keySize = intval($node->textContent);
8690
continue;
8791
}
8892

8993
if ($node->localName === 'OAEPParams') {
90-
Assert::null($oaepParams, $node->tagName . ' cannot be set more than once.', TooManyElementsException::class);
94+
Assert::null(
95+
$oaepParams,
96+
$node->tagName . ' cannot be set more than once.',
97+
TooManyElementsException::class
98+
);
9199
$oaepParams = trim($node->textContent);
92100
continue;
93101
}

0 commit comments

Comments
 (0)