Skip to content
Snippets Groups Projects
Commit 5f43a66b authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Suppress scrutinizer type-issues

parent 05a3c3fe
No related branches found
No related tags found
No related merge requests found
......@@ -202,6 +202,7 @@ class System
$res = @file_put_contents($tmpFile, $data);
if ($res === false) {
/** @var array|null $error */
$error = error_get_last();
throw new Error\Exception(
'Error saving file "' . $tmpFile . '": ' .
......@@ -212,8 +213,8 @@ class System
if (self::getOS() !== self::WINDOWS) {
if (!chmod($tmpFile, $mode)) {
unlink($tmpFile);
/** @var array|null $error */
$error = error_get_last();
//$error = (is_array($error) ? $error['message'] : 'no error available');
throw new Error\Exception(
'Error changing file mode of "' . $tmpFile . '": ' .
(is_array($error) ? $error['message'] : 'no error available')
......@@ -223,6 +224,7 @@ class System
if (!rename($tmpFile, $filename)) {
unlink($tmpFile);
/** @var array|null $error */
$error = error_get_last();
throw new Error\Exception(
'Error moving "' . $tmpFile . '" to "' . $filename . '": ' .
......
......@@ -436,7 +436,7 @@ class XML
* @param array $context
* @return string|null
*/
function (string $public = null, string $system, array $context) {
function (string $public = null, string $system, /** @scrutinizer ignore-unused */ array $context) {
if (filter_var($system, FILTER_VALIDATE_URL) === $system) {
return null;
}
......
......@@ -78,7 +78,9 @@ class Parser
*/
public function getValue(string $xpath, bool $required = false): ?string
{
/** @var array|null $result */
$result = $this->simplexml->xpath($xpath);
if (!is_array($result) || empty($result)) {
if ($required) {
throw new \Exception(
......@@ -88,7 +90,7 @@ class Parser
return null;
}
}
return (string) $result[0];
return strval($result[0]);
}
......@@ -106,6 +108,7 @@ class Parser
return $seek;
}
}
if ($required) {
throw new \Exception(
'Could not get value from XML document using multiple alternative XPath expressions.'
......
......@@ -151,7 +151,7 @@ class AttributeAlter extends Auth\ProcessingFilter
if (preg_match($this->pattern, $value, $matches) > 0) {
$new_value = $matches[0];
if ($this->replacement !== false) {
if (is_string($this->replacement)) {
$new_value = $this->replacement;
}
......
......@@ -60,8 +60,8 @@ class PHP extends Auth\ProcessingFilter
* @param array &$state
*/
$function = /** @return void */ function (
array &$attributes,
array &$state
/** @scrutinizer ignore-unused */ array &$attributes,
/** @scrutinizer ignore-unused */ array &$state
) {
eval($this->code);
};
......
......@@ -78,11 +78,10 @@ class Cron
/**
* Show cron info.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @return \SimpleSAML\XHTML\Template
* An HTML template or a redirection if we are not authenticated.
*/
public function info(Request $request): Template
public function info(): Template
{
$this->authUtils::requireAdmin();
......@@ -117,7 +116,6 @@ class Cron
*
* This controller will start a cron operation
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param string $tag The tag
* @param string $key The secret key
* @param string $output The output format, defaulting to xhtml
......@@ -127,7 +125,7 @@ class Cron
*
* @throws \SimpleSAML\Error\Exception
*/
public function run(Request $request, string $tag, string $key, string $output = 'xhtml'): Response
public function run(string $tag, string $key, string $output = 'xhtml'): Response
{
$configKey = $this->cronconfig->getValue('key', 'secret');
if ($key !== $configKey) {
......
......@@ -25,7 +25,7 @@ function SimpleSAML_exception_handler($exception)
set_exception_handler('SimpleSAML_exception_handler');
// log full backtrace on errors and warnings
function SimpleSAML_error_handler($errno, $errstr, $errfile = null, $errline = 0, $errcontext = null)
function SimpleSAML_error_handler($errno, $errstr, $errfile = null, $errline = 0, /** @scrutinizer ignore-unused */ $errcontext = null)
{
if (\SimpleSAML\Logger::isErrorMasked($errno)) {
// masked error
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment