From 49cb38ff4f047c404b053145cfb3dcc0abf358c0 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 14 Apr 2019 21:14:33 +0200 Subject: [PATCH] ignore uncoverable lines --- Account/Account.php | 2 +- Config/SettingsAbstract.php | 2 +- Localization/Localization.php | 4 ++-- Localization/Money.php | 4 ++-- Log/FileLogger.php | 14 +++++++------- Math/Number/Numbers.php | 2 +- Message/Http/Rest.php | 2 +- Message/RequestAbstract.php | 2 +- Uri/Argument.php | 2 +- Uri/Http.php | 2 +- Utils/ArrayUtils.php | 8 ++++---- Utils/Compression/LZW.php | 4 ++-- Utils/Encoding/Huffman/Huffman.php | 8 ++++---- Utils/StringUtils.php | 2 +- Views/ViewAbstract.php | 2 +- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Account/Account.php b/Account/Account.php index d01c9714d..b234a5a16 100644 --- a/Account/Account.php +++ b/Account/Account.php @@ -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; diff --git a/Config/SettingsAbstract.php b/Config/SettingsAbstract.php index 3cbfc839e..a0cb7778d 100644 --- a/Config/SettingsAbstract.php +++ b/Config/SettingsAbstract.php @@ -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); diff --git a/Localization/Localization.php b/Localization/Localization.php index d24f3d04a..50a28bb28 100644 --- a/Localization/Localization.php +++ b/Localization/Localization.php @@ -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)); diff --git a/Localization/Money.php b/Localization/Money.php index 216444237..4d0255667 100644 --- a/Localization/Money.php +++ b/Localization/Money.php @@ -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'); diff --git a/Log/FileLogger.php b/Log/FileLogger.php index 24a3505d5..ecb31c75e 100644 --- a/Log/FileLogger.php +++ b/Log/FileLogger.php @@ -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); diff --git a/Math/Number/Numbers.php b/Math/Number/Numbers.php index b20c0b42c..ec94f118b 100644 --- a/Math/Number/Numbers.php +++ b/Math/Number/Numbers.php @@ -72,7 +72,7 @@ final class Numbers $split = \str_split($n); if ($split === false) { - return false; + return false; // @codeCoverageIgnore } foreach ($split as $place => $value) { diff --git a/Message/Http/Rest.php b/Message/Http/Rest.php index b870a5178..3348b77c0 100644 --- a/Message/Http/Rest.php +++ b/Message/Http/Rest.php @@ -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); diff --git a/Message/RequestAbstract.php b/Message/RequestAbstract.php index ebc1090ef..58fa63460 100644 --- a/Message/RequestAbstract.php +++ b/Message/RequestAbstract.php @@ -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) { diff --git a/Uri/Argument.php b/Uri/Argument.php index 3e5cd9c76..d851cd798 100644 --- a/Uri/Argument.php +++ b/Uri/Argument.php @@ -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; diff --git a/Uri/Http.php b/Uri/Http.php index 4144a430e..bfedc92d6 100644 --- a/Uri/Http.php +++ b/Uri/Http.php @@ -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; diff --git a/Utils/ArrayUtils.php b/Utils/ArrayUtils.php index 43c19a21c..e4213d2c5 100644 --- a/Utils/ArrayUtils.php +++ b/Utils/ArrayUtils.php @@ -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 */ diff --git a/Utils/Compression/LZW.php b/Utils/Compression/LZW.php index 939ff9a66..33f3802a1 100644 --- a/Utils/Compression/LZW.php +++ b/Utils/Compression/LZW.php @@ -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; diff --git a/Utils/Encoding/Huffman/Huffman.php b/Utils/Encoding/Huffman/Huffman.php index a2047007f..11256e29e 100644 --- a/Utils/Encoding/Huffman/Huffman.php +++ b/Utils/Encoding/Huffman/Huffman.php @@ -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 } } diff --git a/Utils/StringUtils.php b/Utils/StringUtils.php index 918e3b4d8..d9ac5b11b 100644 --- a/Utils/StringUtils.php +++ b/Utils/StringUtils.php @@ -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) { diff --git a/Views/ViewAbstract.php b/Views/ViewAbstract.php index 96ca3c436..be25fb0a0 100644 --- a/Views/ViewAbstract.php +++ b/Views/ViewAbstract.php @@ -260,7 +260,7 @@ abstract class ViewAbstract implements RenderableInterface return (string) \json_encode($includeData); } } catch (\Throwable $e) { - $ob = ''; + $ob = ''; // @codeCoverageIgnore } finally { return $ob; }