Skip to content

Commit

Permalink
Added return statements, updated return types (#958)
Browse files Browse the repository at this point in the history
*    Updated the phpDoc comments to match the code
*    Added return statements
*    Added return values
  • Loading branch information
ArnoVanDerVegt authored and tvdijen committed Oct 17, 2018
1 parent 1465433 commit b038bec
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 15 deletions.
1 change: 1 addition & 0 deletions lib/SimpleSAML/Auth/LDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ private function makeException($description, $type = null)
return new Error\AuthSource('ldap', $description);
}
}
return new \Exception('Unknown LDAP error.');
}


Expand Down
2 changes: 1 addition & 1 deletion lib/SimpleSAML/Auth/ProcessingChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public function processStatePassive(&$state)
*
* @param string $id The state identifier.
* @see State::parseStateID()
* @return Array The state referenced by the $id parameter.
* @return array The state referenced by the $id parameter.
*/
public static function fetchProcessedState($id)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/SimpleSAML/Metadata/SAMLParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ private static function parseKeyDescriptor(\SAML2\XML\md\KeyDescriptor $kd)
*
* @param $protocols Array with the protocols we accept.
*
* @return Array with SP descriptors which supports one of the given protocols.
* @return array with SP descriptors which supports one of the given protocols.
*/
private function getSPDescriptors($protocols)
{
Expand All @@ -1364,7 +1364,7 @@ private function getSPDescriptors($protocols)
*
* @param $protocols Array with the protocols we accept.
*
* @return Array with IdP descriptors which supports one of the given protocols.
* @return array with IdP descriptors which supports one of the given protocols.
*/
private function getIdPDescriptors($protocols)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/SimpleSAML/XHTML/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private function normalizeTemplateName($templateName)
/**
* Set up the places where twig can look for templates.
*
* @return \Twig_Loader_Filesystem The twig template loader or false if the template does not exist.
* @return TemplateLoader The twig template loader or false if the template does not exist.
* @throws \Twig_Error_Loader In case a failure occurs.
*/
private function setupTwigTemplatepaths()
Expand Down
4 changes: 3 additions & 1 deletion modules/authYubiKey/lib/Auth/Source/YubiKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function authenticate(&$state)
*
* @param string $authStateId The identifier of the authentication state.
* @param string $otp The one time password entered-
* @return string Error code in the case of an error.
* @return string|null Error code in the case of an error.
*/
public static function handleLogin($authStateId, $otp)
{
Expand Down Expand Up @@ -158,6 +158,8 @@ public static function handleLogin($authStateId, $otp)

$state['Attributes'] = $attributes;
\SimpleSAML\Auth\Source::completeAuth($state);

return null;
}

/**
Expand Down
5 changes: 4 additions & 1 deletion modules/authfacebook/extlibinc/base_facebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ public function setAccessToken($access_token)
* Extend an access token, while removing the short-lived token that might
* have been generated via client-side flow. Thanks to http://bit.ly/b0Pt0H
* for the workaround.
*
* @return boolean Return true is the access token is set.
*/
public function setExtendedAccessToken()
{
Expand Down Expand Up @@ -390,6 +392,7 @@ public function setExtendedAccessToken()
'access_token',
$response_params['access_token']
);
return true;
}

/**
Expand Down Expand Up @@ -492,7 +495,7 @@ protected function getUserAccessToken()
* Retrieve the signed request, either from a request parameter or,
* if not present, from a cookie.
*
* @return string the signed request, if available, or null otherwise.
* @return array the signed request, if available, or null otherwise.
*/
public function getSignedRequest()
{
Expand Down
1 change: 0 additions & 1 deletion modules/cas/lib/Auth/Source/CAS.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ protected function casValidation($ticket, $service)
/**
* Called by linkback, to finish validate/ finish logging in.
* @param array $state
* @return array username, casattributes/ldap attributes
*/
public function finalStep(&$state)
{
Expand Down
2 changes: 2 additions & 0 deletions modules/cdc/lib/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,5 +420,7 @@ private function setCDC(array $list)
);

\SimpleSAML\Utils\HTTP::setCookie('_saml_idp', $cookie, $params, false);

return '_saml_idp';
}
}
16 changes: 8 additions & 8 deletions modules/consent/lib/Consent/Store/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,16 @@ public function deleteConsent($userId, $destinationId)
);

if ($st === false) {
return;
return 0;
}

if ($st->rowCount() > 0) {
\SimpleSAML\Logger::debug('consent:Database - Deleted consent.');
return $st->rowCount();
} else {
\SimpleSAML\Logger::warning(
'consent:Database - Attempted to delete nonexistent consent'
);
}

\SimpleSAML\Logger::warning('consent:Database - Attempted to delete nonexistent consent');
return 0;
}


Expand All @@ -294,15 +293,16 @@ public function deleteAllConsents($userId)
);

if ($st === false) {
return;
return 0;
}

if ($st->rowCount() > 0) {
\SimpleSAML\Logger::debug('consent:Database - Deleted ('.$st->rowCount().') consent(s).');
return $st->rowCount();
} else {
\SimpleSAML\Logger::warning('consent:Database - Attempted to delete nonexistent consent');
}

\SimpleSAML\Logger::warning('consent:Database - Attempted to delete nonexistent consent');
return 0;
}


Expand Down
1 change: 1 addition & 0 deletions modules/core/lib/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function allows(array $attributes)
return false;
}
}
return false;
}

/**
Expand Down
1 change: 1 addition & 0 deletions modules/statistics/lib/Graph/GoogleCharts.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,6 @@ public static function roof($max)
return $target_top;
}
}
return 1;
}
}

0 comments on commit b038bec

Please sign in to comment.