Other Scrutinizer fixes

This commit is contained in:
Stéphane Goetz 2019-12-07 16:32:38 +01:00
parent 8215808282
commit ac60948fab
12 changed files with 19 additions and 12 deletions

View File

@ -262,7 +262,7 @@ class ConfigBuilder
*/
private function findLocation($path, $basedir, $type) {
// If Path is explicitly null, it's useless to go further
if ($path == null) {
if ($path === null) {
return null;
}

View File

@ -44,7 +44,7 @@ class Serve extends DauxCommand
// Write the current configuration to a file to read it from the other serving side
$file = tmpfile();
if (!$file) {
if ($file === false) {
$output->writeln("<fg=red>Failed to create temporary file for configuration</fg=red>");
return 1;
}

View File

@ -218,6 +218,11 @@ class Api
public function showSourceCode($css, $lineNumber, $column)
{
$lines = preg_split("/\r?\n/", $css);
if ($lines === false) {
return $css;
}
$start = max($lineNumber - 3, 0);
$end = min($lineNumber + 2, count($lines));

View File

@ -45,7 +45,7 @@ class ImageRenderer implements InlineRendererInterface, ConfigurationAwareInterf
);
}
return parent::render($inline, $htmlRenderer);
return $this->parent->render($inline, $htmlRenderer);
}
/**

View File

@ -49,7 +49,7 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator
throw new \RuntimeException("The following options are mandatory for confluence : '" . implode("', '", $errors) . "'");
}
if (!array_key_exists('ancestor_id', $confluence) && !array_key_exists('root_id', $confluence)) {
if (!$confluence->hasAncestorId() && !$confluence->hasRootId()) {
throw new \RuntimeException("You must specify an 'ancestor_id' or a 'root_id' for confluence.");
}
}

View File

@ -39,7 +39,7 @@ class GeneratorHelper
$dir = opendir($source);
if (!$dir) {
if ($dir === false) {
throw new RuntimeException("Cannot copy '$source' to '$destination'");
}

View File

@ -59,7 +59,9 @@ class Builder
*/
public static function build($node, $ignore)
{
if (($it = new \FilesystemIterator($node->getPath())) == false) {
try {
$it = new \FilesystemIterator($node->getPath());
} catch (\UnexpectedValueException $e) {
return;
}