Skip to content

Commit

Permalink
Add trailing comma's
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Jun 16, 2024
1 parent 418fe22 commit a85bc55
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/XML/SignableElementInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public function getId(): ?string;
public function sign(
SignatureAlgorithmInterface $signer,
string $canonicalizationAlg,
?KeyInfo $keyInfo = null
?KeyInfo $keyInfo = null,
): void;
}
2 changes: 1 addition & 1 deletion src/XML/SignableElementTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ abstract public function getId(): ?string;
public function sign(
SignatureAlgorithmInterface $signer,
string $canonicalizationAlg = C::C14N_EXCLUSIVE_WITHOUT_COMMENTS,
?KeyInfo $keyInfo = null
?KeyInfo $keyInfo = null,
): void {
$this->signer = $signer;
$this->keyInfo = $keyInfo;
Expand Down
2 changes: 1 addition & 1 deletion src/XML/SignedElementTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public function verify(SignatureAlgorithmInterface $verifier = null): SignedElem
// build a valid PEM for the certificate
$cert = sprintf(
"-----BEGIN CERTIFICATE-----\n%s\n-----END CERTIFICATE-----",
$data->getRawContent()
$data->getRawContent(),
);

$cert = new Key\X509Certificate(PEM::fromString($cert));
Expand Down
4 changes: 2 additions & 2 deletions src/XML/ds/KeyValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static function fromXML(DOMElement $xml): static
$RSAKeyValue,
1,
'A <ds:KeyValue> can contain exactly one <ds:RSAKeyValue>',
TooManyElementsException::class
TooManyElementsException::class,
);

$elements = [];
Expand All @@ -95,7 +95,7 @@ public static function fromXML(DOMElement $xml): static
$elements,
1,
'A <ds:KeyValue> can contain exactly one element in namespace ##other',
TooManyElementsException::class
TooManyElementsException::class,
);

return new static(array_pop($RSAKeyValue), array_pop($elements));
Expand Down
8 changes: 4 additions & 4 deletions src/XML/ds/RSAKeyValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,27 @@ public static function fromXML(DOMElement $xml): static
$modulus,
1,
'An <ds:RSAKeyValue> must contain exactly one <ds:Modulus>',
MissingElementException::class
MissingElementException::class,
);
Assert::maxCount(
$modulus,
1,
'An <ds:RSAKeyValue> must contain exactly one <ds:Modulus>',
TooManyElementsException::class
TooManyElementsException::class,
);

$exponent = Exponent::getChildrenOfClass($xml);
Assert::minCount(
$exponent,
1,
'An <ds:RSAKeyValue> must contain exactly one <ds:Modulus>',
MissingElementException::class
MissingElementException::class,
);
Assert::maxCount(
$exponent,
1,
'An <ds:RSAKeyValue> must contain exactly one <ds:Modulus>',
TooManyElementsException::class
TooManyElementsException::class,
);

return new static(array_pop($modulus), array_pop($exponent));
Expand Down
2 changes: 1 addition & 1 deletion src/XML/ds/RetrievalMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static function fromXML(DOMElement $xml): static
return new static(
array_pop($transforms),
$URI,
$Type
$Type,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/XML/ds/Transform.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ final public function __construct(
sprintf(
'Transform algorithm "%s" or "%s" required if InclusiveNamespaces provided.',
C::C14N_EXCLUSIVE_WITH_COMMENTS,
C::C14N_EXCLUSIVE_WITHOUT_COMMENTS
C::C14N_EXCLUSIVE_WITHOUT_COMMENTS,
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/XML/ec/InclusiveNamespaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final public function __construct(
Assert::allString(
$prefixes,
'Can only add string InclusiveNamespaces prefixes.',
InvalidArgumentException::class
InvalidArgumentException::class,
);
Assert::allRegex($prefixes, '/^[a-z0-9._\\-:]*$/i', SchemaViolationException::class); // xsd:NMTOKEN
}
Expand Down
4 changes: 2 additions & 2 deletions src/XML/xenc/CipherData.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ public static function fromXML(DOMElement $xml): static
$cv,
1,
'More than one CipherValue element in <xenc:CipherData>',
TooManyElementsException::class
TooManyElementsException::class,
);

$cr = CipherReference::getChildrenOfClass($xml);
Assert::maxCount(
$cr,
1,
'More than one CipherReference element in <xenc:CipherData>',
TooManyElementsException::class
TooManyElementsException::class,
);

return new static(
Expand Down
2 changes: 1 addition & 1 deletion tests/XML/CustomSignable.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class CustomSignable extends AbstractElement implements
*/
final public function __construct(
protected DOMElement $xml,
protected ?string $id
protected ?string $id,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion tests/XML/SignableElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function testSigningElementWithIdAndComments(): void

$customSignable->sign($signer, C::C14N_EXCLUSIVE_WITH_COMMENTS, $keyInfo);
$signed = DOMDocumentFactory::fromFile(
dirname(__FILE__, 2) . '/resources/xml/custom_CustomSignableSignedWithCommentsAndId.xml'
dirname(__FILE__, 2) . '/resources/xml/custom_CustomSignableSignedWithCommentsAndId.xml',
);

$this->assertEquals(
Expand Down
2 changes: 1 addition & 1 deletion tests/XML/SignedElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function setUp(): void
)->documentElement;

$this->certificate = PEM::fromString(
PEMCertificatesMock::getPlainCertificate(PEMCertificatesMock::SELFSIGNED_CERTIFICATE)
PEMCertificatesMock::getPlainCertificate(PEMCertificatesMock::SELFSIGNED_CERTIFICATE),
);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/XML/ds/DigestMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public function testMarshalling(): void
C::DIGEST_SHA256,
[
new Chunk(DOMDocumentFactory::fromString(
'<some:Chunk xmlns:some="urn:test:some">Random</some:Chunk>'
)->documentElement)
'<some:Chunk xmlns:some="urn:test:some">Random</some:Chunk>',
)->documentElement),
],
);

Expand Down
2 changes: 1 addition & 1 deletion tests/XML/ds/KeyInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function testMarshalling(): void
],
),
new Chunk(DOMDocumentFactory::fromString(
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>'
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',
)->documentElement),
],
'fed654',
Expand Down
4 changes: 2 additions & 2 deletions tests/XML/ds/KeyValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function testMarshallingEmpty(): void
{
$this->expectException(SchemaViolationException::class);
$this->expectExceptionMessage(
'A <ds:KeyValue> requires either a RSAKeyValue or an element in namespace ##other'
'A <ds:KeyValue> requires either a RSAKeyValue or an element in namespace ##other',
);

new KeyValue(null, null);
Expand Down Expand Up @@ -147,7 +147,7 @@ public function testUnmarshallingEmpty(): void

$this->expectException(SchemaViolationException::class);
$this->expectExceptionMessage(
'A <ds:KeyValue> requires either a RSAKeyValue or an element in namespace ##other'
'A <ds:KeyValue> requires either a RSAKeyValue or an element in namespace ##other',
);

KeyValue::fromXML($document->documentElement);
Expand Down
12 changes: 6 additions & 6 deletions tests/XML/ds/ObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function setUpBeforeClass(): void
self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd';

self::$xmlRepresentation = DOMDocumentFactory::fromFile(
dirname(__FILE__, 3) . '/resources/xml/ds_Object.xml'
dirname(__FILE__, 3) . '/resources/xml/ds_Object.xml',
);
}

Expand All @@ -53,15 +53,15 @@ public function testMarshalling(): void
new Chunk(
DOMDocumentFactory::fromString(sprintf(
'<ssp:data xmlns:ssp="urn:ssp:custom">%s</ssp:data>',
$img
))->documentElement
)
$img,
))->documentElement,
),
],
);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($obj)
strval($obj),
);
}

Expand All @@ -75,7 +75,7 @@ public function testMarshallingEmptyElement(): void
$obj = new DsObject(null, null, null, []);
$this->assertEquals(
"<ds:Object xmlns:ds=\"$ds_ns\"/>",
strval($obj)
strval($obj),
);
$this->assertTrue($obj->isEmptyElement());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/XML/ds/ReferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function testMarshallingReferenceElementOrdering(): void
[
new Transform(C::XMLDSIG_ENVELOPED),
new Transform(C::C14N_EXCLUSIVE_WITHOUT_COMMENTS),
]
],
),
'ghi789',
'urn:some:type',
Expand Down
6 changes: 3 additions & 3 deletions tests/XML/ds/SignaturePropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ public static function setUpBeforeClass(): void
public function testMarshalling(): void
{
$document = DOMDocumentFactory::fromString(
'<ssp:HSMSerialNumber xmlns:ssp="urn:x-simplesamlphp:namespace">1234567890</ssp:HSMSerialNumber>'
'<ssp:HSMSerialNumber xmlns:ssp="urn:x-simplesamlphp:namespace">1234567890</ssp:HSMSerialNumber>',
);

$signatureProperty = new SignatureProperty(
[new Chunk($document->documentElement)],
'https://simplesamlphp.org/some/target',
'abc123'
'abc123',
);
$signatureProperties = new SignatureProperties([$signatureProperty], 'def456');

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($signatureProperties)
strval($signatureProperties),
);
}
}
4 changes: 2 additions & 2 deletions tests/XML/ds/SignaturePropertyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public function testMarshalling(): void
$signatureProperty = new SignatureProperty(
[new Chunk($document->documentElement)],
'https://simplesamlphp.org/some/target',
'abc123'
'abc123',
);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($signatureProperty)
strval($signatureProperty),
);
}
}
6 changes: 3 additions & 3 deletions tests/XML/ds/X509DataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function testMarshalling(): void
[
new Chunk(
DOMDocumentFactory::fromString(
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>'
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',
)->documentElement,
),
new X509Certificate(self::$certificate),
Expand All @@ -102,8 +102,8 @@ public function testMarshalling(): void
),
new X509SubjectName(self::$certData['name']),
new Chunk(DOMDocumentFactory::fromString(
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">other</ssp:Chunk>'
)->documentElement)
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">other</ssp:Chunk>',
)->documentElement),
],
);

Expand Down
2 changes: 1 addition & 1 deletion tests/XML/xenc/EncryptedDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function testMarshallingElementOrdering(): void
$encryptedDataElements = XPath::xpQuery(
$encryptedDataElement,
'./xenc:EncryptionMethod/following-sibling::*',
$xpCache
$xpCache,
);
$this->assertCount(2, $encryptedDataElements);
$this->assertEquals('ds:KeyInfo', $encryptedDataElements[0]->tagName);
Expand Down
4 changes: 2 additions & 2 deletions tests/XML/xenc/ReferenceListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public function testMarshalling(): void

$referenceList = new ReferenceList(
[
new DataReference('#Encrypted_DATA_ID', [new Transforms([$transformData])])
new DataReference('#Encrypted_DATA_ID', [new Transforms([$transformData])]),
],
[
new KeyReference('#Encrypted_KEY_ID', [new Transforms([$transformKey])])
new KeyReference('#Encrypted_KEY_ID', [new Transforms([$transformKey])]),
],
);

Expand Down

0 comments on commit a85bc55

Please sign in to comment.