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 May 27, 2024
1 parent f83db24 commit 5c9fb2c
Show file tree
Hide file tree
Showing 161 changed files with 615 additions and 611 deletions.
6 changes: 3 additions & 3 deletions bin/convertTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function dissectFile(array $fileInputRaw): array
STDERR,
"Merging (for nullify) " . count($sourcePairs) .
" entries from source language (destination language has " .
count($destPairs) . " already.\n"
count($destPairs) . " already.\n",
);
$outputPairs = mergeWithSource($sourcePairs, $destPairs);
foreach ($outputPairs as $key => $value) {
Expand All @@ -132,7 +132,7 @@ function dissectFile(array $fileInputRaw): array
STDERR,
"Merging " . count($sourcePairs) .
" entries from source language (destination language has " .
count($destPairs) . " already.\n"
count($destPairs) . " already.\n",
);
$outputPairs = mergeWithSource($sourcePairs, $destPairs);
break;
Expand All @@ -141,7 +141,7 @@ function dissectFile(array $fileInputRaw): array
STDERR,
"Codifying " . count($sourcePairs) .
" entries from destination language (pool has " .
count($destPairs) . " candidates).\n"
count($destPairs) . " candidates).\n",
);
$outputPairs = codifyWithSource($sourcePairs, $destPairs);
break;
Expand Down
2 changes: 1 addition & 1 deletion bin/translateAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
[
'en' => $defs['attribute_' . $lower]['en'],
],
$trans['attribute_' . $lower]
$trans['attribute_' . $lower],
),
];
}
Expand Down
4 changes: 2 additions & 2 deletions modules/admin/src/Controller/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Config
*/
public function __construct(
protected Configuration $config,
protected Session $session
protected Session $session,
) {
$this->menu = new Menu();
$this->authUtils = new Utils\Auth();
Expand Down Expand Up @@ -466,7 +466,7 @@ protected function getWarnings(): array
$warnings[] = [
Translate::noop(
'You are running an outdated version of SimpleSAMLphp. Please update to <a href="' .
'%latest%">the latest version</a> as soon as possible.'
'%latest%">the latest version</a> as soon as possible.',
),
[
'%latest%' => $latest['html_url'],
Expand Down
20 changes: 10 additions & 10 deletions modules/admin/src/Controller/Federation.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Federation
* @param \SimpleSAML\Configuration $config The configuration to use.
*/
public function __construct(
protected Configuration $config
protected Configuration $config,
) {
$this->menu = new Menu();
$this->mdHandler = MetaDataStorageHandler::getMetadataHandler($config);
Expand Down Expand Up @@ -222,7 +222,7 @@ private function getHostedIdP(): array
$saml2entities['saml20-idp'] = $this->mdHandler->getMetaDataCurrent('saml20-idp-hosted');
$saml2entities['saml20-idp']['url'] = $metadataBase;
$saml2entities['saml20-idp']['metadata_array'] = SAML2_IdP::getHostedMetadata(
$this->mdHandler->getMetaDataCurrentEntityID('saml20-idp-hosted')
$this->mdHandler->getMetaDataCurrentEntityID('saml20-idp-hosted'),
);
}

Expand All @@ -231,7 +231,7 @@ private function getHostedIdP(): array
Assert::maxLength(
$entity['entityid'],
C::SAML2INT_ENTITYID_MAX_LENGTH,
sprintf('The entityID cannot be longer than %d characters.', C::SAML2INT_ENTITYID_MAX_LENGTH)
sprintf('The entityID cannot be longer than %d characters.', C::SAML2INT_ENTITYID_MAX_LENGTH),
);

$builder = new SAMLBuilder($entity['entityid']);
Expand All @@ -241,7 +241,7 @@ private function getHostedIdP(): array
$entity['metadata'] = Signer::sign(
$builder->getEntityDescriptorText(),
$entity['metadata_array'],
'SAML 2 IdP'
'SAML 2 IdP',
);
$entities[$index] = $entity;
}
Expand All @@ -268,7 +268,7 @@ private function getHostedIdP(): array
$adfsentities['adfs-idp'] = $this->mdHandler->getMetaDataCurrent('adfs-idp-hosted');
$adfsentities['adfs-idp']['url'] = Module::getModuleURL('adfs/idp/metadata.php');
$adfsentities['adfs-idp']['metadata_array'] = ADFS_IdP::getHostedMetadata(
$this->mdHandler->getMetaDataCurrentEntityID('adfs-idp-hosted')
$this->mdHandler->getMetaDataCurrentEntityID('adfs-idp-hosted'),
);
}

Expand All @@ -277,7 +277,7 @@ private function getHostedIdP(): array
Assert::maxLength(
$entity['entityid'],
C::SAML2INT_ENTITYID_MAX_LENGTH,
sprintf('The entityID cannot be longer than %d characters.', C::SAML2INT_ENTITYID_MAX_LENGTH)
sprintf('The entityID cannot be longer than %d characters.', C::SAML2INT_ENTITYID_MAX_LENGTH),
);

$builder = new SAMLBuilder($entity['entityid']);
Expand All @@ -298,7 +298,7 @@ private function getHostedIdP(): array
$entity['metadata'] = Signer::sign(
$builder->getEntityDescriptorText(),
$entity['metadata_array'],
'ADFS IdP'
'ADFS IdP',
);
$entities[$index] = $entity;
}
Expand Down Expand Up @@ -358,8 +358,8 @@ private function getHostedSP(): array
'name',
$source->getMetadata()->getOptionalLocalizedString(
'OrganizationDisplayName',
['en' => $source->getAuthId()]
)
['en' => $source->getAuthId()],
),
);

$builder = new SAMLBuilder($source->getEntityId());
Expand Down Expand Up @@ -523,7 +523,7 @@ public function downloadCert(Request $request): Response
$response = new Response($certInfo['PEM']);
$disposition = $response->headers->makeDisposition(
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
'cert.pem'
'cert.pem',
);

$response->headers->set('Content-Disposition', $disposition);
Expand Down
2 changes: 1 addition & 1 deletion modules/admin/src/Controller/Sandbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Sandbox
*/
public function __construct(
protected Configuration $config,
protected Session $session
protected Session $session,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion modules/admin/src/Controller/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Test
*/
public function __construct(
protected Configuration $config,
protected Session $session
protected Session $session,
) {
$this->menu = new Menu();
$this->authUtils = new Utils\Auth();
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/Auth/Process/AttributeAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct(array &$config, $reserved)
foreach ($values as $value) {
if (!is_string($value)) {
throw new Exception(
'Invalid value for attribute ' . $name . ': ' . var_export($values, true)
'Invalid value for attribute ' . $name . ': ' . var_export($values, true),
);
}
}
Expand Down
10 changes: 5 additions & 5 deletions modules/core/src/Auth/Process/AttributeAlter.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function process(array &$state): void

if (!$this->replace && !$this->remove && $this->replacement === false) {
throw new Error\Exception(
"'replacement' must be set if neither '%replace' nor " . "'%remove' are set."
"'replacement' must be set if neither '%replace' nor " . "'%remove' are set.",
);
}

Expand Down Expand Up @@ -174,7 +174,7 @@ public function process(array &$state): void
$value = $new_value;
} elseif ($this->merge === true) {
$attributes[$this->target] = array_values(
array_diff($attributes[$this->target], [$value])
array_diff($attributes[$this->target], [$value]),
);
$attributes[$this->target][] = $new_value;
} else {
Expand Down Expand Up @@ -202,16 +202,16 @@ public function process(array &$state): void
$attributes[$this->target] = preg_replace(
$this->pattern,
$this->replacement,
$attributes[$this->subject]
$attributes[$this->subject],
);
} else {
$diff = array_diff(
preg_replace(
$this->pattern,
$this->replacement,
$attributes[$this->subject]
$attributes[$this->subject],
),
$attributes[$this->subject]
$attributes[$this->subject],
);

if ($this->merge === true) {
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/Auth/Process/AttributeLimit.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function process(array &$state): void
if (array_key_exists($regexpMatch, $allowedAttributeRegex)) {
$attributes[$name] = $this->filterAttributeValues(
$attributes[$name],
$allowedAttributeRegex[$regexpMatch]
$allowedAttributeRegex[$regexpMatch],
);
}
if (!empty($attributes[$name])) {
Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/Auth/Process/AttributeValueMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function __construct(array &$config, $reserved)
} else {
// unknown configuration option, log it and ignore the error
Logger::warning(
"AttributeValueMap: unknown configuration flag '" . var_export($value, true) . "'"
"AttributeValueMap: unknown configuration flag '" . var_export($value, true) . "'",
);
}
continue;
Expand Down Expand Up @@ -148,7 +148,7 @@ public function process(array &$state): void
} else {
$attributes[$this->targetattribute] = array_unique(array_merge(
$attributes[$this->targetattribute],
$targetvalues
$targetvalues,
));
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/Auth/Process/GenerateGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private static function escapeIllegalChars(string $string): string
function ($m) {
return sprintf("%%%02x", ord($m[1]));
},
$string
$string,
);
}
}
2 changes: 1 addition & 1 deletion modules/core/src/Auth/Process/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function process(array &$state): void
*/
$function = function (
/** @scrutinizer ignore-unused */ array &$attributes,
/** @scrutinizer ignore-unused */ array &$state
/** @scrutinizer ignore-unused */ array &$state,
): void {
eval($this->code);
};
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/Auth/Process/ScopeFromAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function process(array &$state): void
$scope = substr($sourceAttrVal, $scopeIndex + 1);
$attributes[$this->targetAttribute][] = $scope;
Logger::debug(
'ScopeFromAttribute: Inserted new attribute ' . $this->targetAttribute . ', with scope ' . $scope
'ScopeFromAttribute: Inserted new attribute ' . $this->targetAttribute . ', with scope ' . $scope,
);
} else {
Logger::warning('ScopeFromAttribute: The configured source attribute ' . $this->sourceAttribute
Expand Down
6 changes: 3 additions & 3 deletions modules/core/src/Auth/Process/TargetedID.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct(array &$config, $reserved)
Assert::keyExists($config, 'identifyingAttribute', "Missing mandatory 'identifyingAttribute' config setting.");
Assert::stringNotEmpty(
$config['identifyingAttribute'],
"TargetedID: 'identifyingAttribute' must be a non-empty string."
"TargetedID: 'identifyingAttribute' must be a non-empty string.",
);

$this->identifyingAttribute = $config['identifyingAttribute'];
Expand Down Expand Up @@ -109,8 +109,8 @@ public function process(array &$state): void
Logger::warning(
sprintf(
"core:TargetedID: Missing attribute '%s', which is needed to generate the TargetedID.",
$this->identifyingAttribute
)
$this->identifyingAttribute,
),
);

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected function selectAuthSource(array &$state): string
|| $requestedContexts['AuthnContextClassRef'] === null
) {
Logger::info(
"core:RequestedAuthnContextSelector: no RequestedAuthnContext provided; selecting default authsource"
"core:RequestedAuthnContextSelector: no RequestedAuthnContext provided; selecting default authsource",
);

if (array_key_exists('default', $this->contexts)) {
Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/Auth/Source/SourceIPSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ public function __construct(array $info, array $config)
foreach ($zones as $key => $zone) {
if (!array_key_exists('source', $zone)) {
throw new Error\Exception(
sprintf("Incomplete zone-configuration '%s' due to missing `source` key.", $key)
sprintf("Incomplete zone-configuration '%s' due to missing `source` key.", $key),
);
} elseif (!array_key_exists('subnet', $zone)) {
throw new Error\Exception(
sprintf("Incomplete zone-configuration '%s' due to missing `subnet` key.", $key)
sprintf("Incomplete zone-configuration '%s' due to missing `subnet` key.", $key),
);
} else {
$this->zones[$key] = $zone;
Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/Auth/UserPassOrgBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public static function handleLogin(
string $authStateId,
string $username,
string $password,
string $organization
string $organization,
): Response {
/* Retrieve the authentication state. */
$state = Auth\State::loadState($authStateId, self::STAGEID);
Expand Down Expand Up @@ -308,7 +308,7 @@ public static function handleLogin(

Logger::stats(
'User \'' . $username . '\' at \'' . $organization
. '\' successfully authenticated from ' . $_SERVER['REMOTE_ADDR']
. '\' successfully authenticated from ' . $_SERVER['REMOTE_ADDR'],

Check warning on line 311 in modules/core/src/Auth/UserPassOrgBase.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyNullOperand

modules/core/src/Auth/UserPassOrgBase.php:311:55: PossiblyNullOperand: Cannot concatenate with a possibly null null|string (see https://psalm.dev/080)
);

// Add the selected Org to the state
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/Controller/ErrorReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ErrorReport
*/
public function __construct(
protected Configuration $config,
protected Session $session
protected Session $session,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions modules/core/src/Controller/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Exception
*/
public function __construct(
protected Configuration $config,
protected Session $session
protected Session $session,
) {
}

Expand Down Expand Up @@ -122,14 +122,14 @@ public function cardinality(Request $request): Response
$state = Auth\State::loadState($stateId, 'core:cardinality');
Logger::stats(
'core:cardinality:error ' . $state['Destination']['entityid'] . ' ' . $state['saml:sp:IdP'] .
' ' . implode(',', array_keys($state['core:cardinality:errorAttributes']))
' ' . implode(',', array_keys($state['core:cardinality:errorAttributes'])),
);

$t = new Template($this->config, 'core:cardinality_error.twig');
$t->data['cardinalityErrorAttributes'] = $state['core:cardinality:errorAttributes'];
if (isset($state['Source']['auth'])) {
$t->data['LogoutURL'] = Module::getModuleURL(
'saml/sp/login/' . urlencode($state['Source']['auth'])
'saml/sp/login/' . urlencode($state['Source']['auth']),
);
}

Expand Down
8 changes: 4 additions & 4 deletions modules/core/src/Controller/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Login
* @throws \Exception
*/
public function __construct(
protected Configuration $config
protected Configuration $config,
) {
}

Expand Down Expand Up @@ -107,7 +107,7 @@ public function loginuserpass(Request $request): Response
$source = $this->authSource::getById($state[UserPassBase::AUTHID]);
if ($source === null) {
throw new BuiltinException(
'Could not find authentication source with id ' . $state[UserPassBase::AUTHID]
'Could not find authentication source with id ' . $state[UserPassBase::AUTHID],
);
}

Expand Down Expand Up @@ -326,7 +326,7 @@ public function loginuserpassorg(Request $request): Response
$source = $this->authSource::getById($state[UserPassOrgBase::AUTHID]);
if ($source === null) {
throw new BuiltinException(
'Could not find authentication source with id ' . $state[UserPassOrgBase::AUTHID]
'Could not find authentication source with id ' . $state[UserPassOrgBase::AUTHID],
);
}

Expand Down Expand Up @@ -355,7 +355,7 @@ private function renderCookie(
?bool $secure = null,
bool $httponly = true,
bool $raw = false,
?string $sameSite = 'none'
?string $sameSite = 'none',
): Cookie {
return new Cookie($name, $value, $expire, $path, $domain, $secure, $httponly, $raw, $sameSite);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/Controller/Logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Logout
* @param \SimpleSAML\Configuration $config The configuration to use by the controllers.
*/
public function __construct(
protected Configuration $config
protected Configuration $config,
) {
}

Expand Down
Loading

0 comments on commit 5c9fb2c

Please sign in to comment.