ignore uncoverable lines

This commit is contained in:
Dennis Eichhorn 2019-04-14 21:14:33 +02:00
parent be9636a846
commit 49cb38ff4f
15 changed files with 30 additions and 30 deletions

View File

@ -570,7 +570,7 @@ class Account implements ArrayableInterface, \JsonSerializable
$temp = \password_hash($password, \PASSWORD_DEFAULT);
if ($temp === false) {
throw new \Exception('Internal password_hash error.');
throw new \Exception('Internal password_hash error.'); // @codeCoverageIgnore
}
$this->password = $temp;

View File

@ -102,7 +102,7 @@ abstract class SettingsAbstract implements OptionsInterface
$options = $sth->fetchAll(\PDO::FETCH_KEY_PAIR);
if ($options === false) {
return [];
return []; // @codeCoverageIgnore
}
$this->setOptions($options);

View File

@ -172,7 +172,7 @@ class Localization
$fileContent = \file_get_contents($file);
if ($fileContent === false) {
break;
break; // @codeCoverageIgnore
}
$this->importLocale(\json_decode($fileContent, true));
@ -183,7 +183,7 @@ class Localization
$fileContent = \file_get_contents(__DIR__ . '/../Localization/Defaults/Definitions/en_US.json');
if ($fileContent === false) {
return;
return; // @codeCoverageIgnore
}
$this->importLocale(\json_decode($fileContent, true));

View File

@ -111,7 +111,7 @@ final class Money implements \Serializable
$split = \explode($decimal, $value);
if ($split === false) {
throw new \Exception('Internal explode error.');
throw new \Exception('Internal explode error.'); // @codeCoverageIgnore
}
$left = $split[0];
@ -124,7 +124,7 @@ final class Money implements \Serializable
$right = \substr($right, 0, self::MAX_DECIMALS);
if ($right === false) {
throw new \Exception('Internal substr error.');
throw new \Exception('Internal substr error.'); // @codeCoverageIgnore
}
return ((int) $left) * 10 ** self::MAX_DECIMALS + (int) \str_pad($right, self::MAX_DECIMALS, '0');

View File

@ -272,7 +272,7 @@ final class FileLogger implements LoggerInterface
$this->createFile();
if (!\is_writable($this->path)) {
return;
return; // @codeCoverageIgnore
}
$this->fp = \fopen($this->path, 'a');
@ -389,7 +389,7 @@ final class FileLogger implements LoggerInterface
$this->fp = \fopen($this->path, 'r');
if ($this->fp === false) {
return $levels;
return $levels; // @codeCoverageIgnore
}
\fseek($this->fp, 0);
@ -397,7 +397,7 @@ final class FileLogger implements LoggerInterface
while ($line !== false && $line !== null) {
if (\count($line) < 2) {
continue;
continue; // @codeCoverageIgnore
}
$line[1] = \trim($line[1]);
@ -436,7 +436,7 @@ final class FileLogger implements LoggerInterface
$this->fp = \fopen($this->path, 'r');
if ($this->fp === false) {
return $connection;
return $connection; // @codeCoverageIgnore
}
\fseek($this->fp, 0);
@ -444,7 +444,7 @@ final class FileLogger implements LoggerInterface
while ($line !== false && $line !== null) {
if (\count($line) < 3) {
continue;
continue; // @codeCoverageIgnore
}
$line[2] = \trim($line[2]);
@ -486,7 +486,7 @@ final class FileLogger implements LoggerInterface
$this->fp = \fopen($this->path, 'r');
if ($this->fp === false) {
return $logs;
return $logs; // @codeCoverageIgnore
}
\fseek($this->fp, 0);
@ -542,7 +542,7 @@ final class FileLogger implements LoggerInterface
$this->fp = \fopen($this->path, 'r');
if ($this->fp === false) {
return $log;
return $log; // @codeCoverageIgnore
}
\fseek($this->fp, 0);

View File

@ -72,7 +72,7 @@ final class Numbers
$split = \str_split($n);
if ($split === false) {
return false;
return false; // @codeCoverageIgnore
}
foreach ($split as $place => $value) {

View File

@ -41,7 +41,7 @@ final class Rest
$curl = \curl_init();
if ($curl === false) {
throw new \Exception('Internal curl_init error.');
throw new \Exception('Internal curl_init error.'); // @codeCoverageIgnore
}
\curl_setopt($curl, CURLOPT_NOBODY, true);

View File

@ -214,7 +214,7 @@ abstract class RequestAbstract implements MessageInterface
$list = \explode($delim, $this->data[$key]);
if ($list === false) {
return [];
return []; // @codeCoverageIgnore
}
foreach ($list as $i => $e) {

View File

@ -197,7 +197,7 @@ final class Argument implements UriInterface
$path = \substr($this->path, 0, -4);
if ($path === false) {
throw new \Exception();
throw new \Exception(); // @codeCoverageIgnore
}
$this->path = $path;

View File

@ -178,7 +178,7 @@ final class Http implements UriInterface
$path = \substr($this->path, 0, -4);
if ($path === false) {
throw new \Exception();
throw new \Exception(); // @codeCoverageIgnore
}
$this->path = $path;

View File

@ -54,7 +54,7 @@ final class ArrayUtils
$node = null;
if ($nodes === false) {
throw new \Exception();
throw new \Exception(); // @codeCoverageIgnore
}
foreach ($nodes as $node) {
@ -93,7 +93,7 @@ final class ArrayUtils
$current = &$data;
if ($pathParts === false) {
throw new \Exception();
throw new \Exception(); // @codeCoverageIgnore
}
foreach ($pathParts as $key) {
@ -132,7 +132,7 @@ final class ArrayUtils
$current = $data;
if ($pathParts === false) {
throw new \Exception();
throw new \Exception(); // @codeCoverageIgnore
}
foreach ($pathParts as $key) {
@ -281,7 +281,7 @@ final class ArrayUtils
$outstream = \fopen('php://memory', 'r+');
if ($outstream === false) {
throw new \Exception();
throw new \Exception(); // @codeCoverageIgnore
}
/** @noinspection PhpMethodParametersCountMismatchInspection */

View File

@ -70,7 +70,7 @@ class LZW implements CompressionInterface
$entry = '';
$dictSize = 256;
if (empty($compressed)) {
if (empty($compressed) || $compressed === false) {
return '';
}
@ -90,7 +90,7 @@ class LZW implements CompressionInterface
} elseif ($k === $dictSize) {
$entry = $w . $w[0];
} else {
throw new \Exception('Wrong dictionary size!' . $k . '.' . $dictSize);
throw new \Exception('Wrong dictionary size!' . $k . '.' . $dictSize); // @codeCoverageIgnore
}
$result .= $entry;

View File

@ -130,12 +130,12 @@ final class Huffman
$pos = \strpos($decbin, '1');
if ($pos === false) {
throw new \Exception();
throw new \Exception(); // @codeCoverageIgnore
}
$decbin = \substr($decbin, $pos + 1);
if ($decbin === false) {
throw new \Exception();
throw new \Exception(); // @codeCoverageIgnore
}
}
@ -143,12 +143,12 @@ final class Huffman
$pos = \strrpos($decbin, '1');
if ($pos === false) {
throw new \Exception();
throw new \Exception(); // @codeCoverageIgnore
}
$decbin = \substr($decbin, 0, $pos);
if ($decbin === false) {
throw new \Exception();
throw new \Exception(); // @codeCoverageIgnore
}
}

View File

@ -526,7 +526,7 @@ final class StringUtils
$n2 = \count($to);
if ($n1 < 1 || $n2 < 1) {
throw new \Exception();
throw new \Exception(); // @codeCoverageIgnore
}
for ($j = -1; $j < $n2; ++$j) {

View File

@ -260,7 +260,7 @@ abstract class ViewAbstract implements RenderableInterface
return (string) \json_encode($includeData);
}
} catch (\Throwable $e) {
$ob = '';
$ob = ''; // @codeCoverageIgnore
} finally {
return $ob;
}