diff --git a/Utils/Encoding/Huffman/Huffman.php b/Utils/Encoding/Huffman/Huffman.php index ded8b2513..d70b1fb8a 100644 --- a/Utils/Encoding/Huffman/Huffman.php +++ b/Utils/Encoding/Huffman/Huffman.php @@ -39,7 +39,7 @@ final class Huffman * * @since 1.0.0 */ - public function getDictionary() /* : ?Dictionary */ + public function getDictionary() : ?Dictionary { return $this->dictionary; } @@ -111,7 +111,7 @@ final class Huffman */ public function decode(string $raw) : string { - if (empty($raw)) { + if (empty($raw) || $this->dictionary === null) { return ''; } diff --git a/Utils/Git/Commit.php b/Utils/Git/Commit.php index fa5f4e5fa..f50931426 100644 --- a/Utils/Git/Commit.php +++ b/Utils/Git/Commit.php @@ -35,26 +35,26 @@ class Commit /** * Author. * - * @var null|Author + * @var Author * @since 1.0.0 */ - private ?Author $author = null; + private Author $author; /** * Branch. * - * @var null|Branch + * @var Branch * @since 1.0.0 */ - private ?Branch $branch = null; + private Branch $branch; /** * Tag. * - * @var null|Tag + * @var Tag * @since 1.0.0 */ - private ?Tag $tag = null; + private Tag $tag; /** * Commit date. @@ -67,10 +67,10 @@ class Commit /** * Repository. * - * @var null|Repository + * @var Repository * @since 1.0.0 */ - private ?Repository $repository = null; + private Repository $repository; /** * Commit message. diff --git a/Utils/Git/Repository.php b/Utils/Git/Repository.php index 896055d48..23281c0a6 100644 --- a/Utils/Git/Repository.php +++ b/Utils/Git/Repository.php @@ -55,10 +55,10 @@ class Repository /** * Current branch. * - * @var null|Branch + * @var Branch * @since 1.0.0 */ - private ?Branch $branch = null; + private Branch $branch; /** * Constructor @@ -72,6 +72,8 @@ class Repository if (\is_dir($path)) { $this->setPath($path); } + + $this->branch = new Branch(); } /** diff --git a/Utils/NumericUtils.php b/Utils/NumericUtils.php new file mode 100644 index 000000000..7393d1703 --- /dev/null +++ b/Utils/NumericUtils.php @@ -0,0 +1,46 @@ +> $b) & ~(1 << (8 * \PHP_INT_SIZE - 1)>>($b - 1)); + } +} diff --git a/Utils/StringCompare.php b/Utils/StringCompare.php index 188b18d4a..44e2a26c2 100644 --- a/Utils/StringCompare.php +++ b/Utils/StringCompare.php @@ -174,8 +174,8 @@ final class StringCompare */ public static function fuzzyMatch( string $s1, string $s2, - float $phraseWeight = 0.5, float $wordWeight = 1, - float $minWeight = 10, float $maxWeight = 1, + float $phraseWeight = 0.5, float $wordWeight = 1.0, + float $minWeight = 10.0, float $maxWeight = 1.0, float $lengthWeight = -0.3 ) : float { diff --git a/Utils/TaskSchedule/Interval.php b/Utils/TaskSchedule/Interval.php index 8c0083bca..e6cd047cd 100644 --- a/Utils/TaskSchedule/Interval.php +++ b/Utils/TaskSchedule/Interval.php @@ -28,10 +28,10 @@ class Interval implements \Serializable /** * Start. * - * @var null|\DateTime + * @var \DateTime * @since 1.0.0 */ - private $start = null; + private $start; /** * End. @@ -243,7 +243,7 @@ class Interval implements \Serializable * * @since 1.0.0 */ - public function getEnd() + public function getEnd() : ?\DateTime { return $this->end; } diff --git a/Utils/TaskSchedule/TaskAbstract.php b/Utils/TaskSchedule/TaskAbstract.php index 1464f1970..8fda2244f 100644 --- a/Utils/TaskSchedule/TaskAbstract.php +++ b/Utils/TaskSchedule/TaskAbstract.php @@ -59,18 +59,18 @@ abstract class TaskAbstract /** * Next runtime * - * @var null|\DateTime + * @var \DateTime * @since 1.0.0 */ - protected ?\DateTime $nextRunTime = null; + protected \DateTime $nextRunTime; /** * Last runtime * - * @var null|\DateTime + * @var \DateTime * @since 1.0.0 */ - protected ?\DateTime $lastRunTime = null; + protected \DateTime $lastRunTime; /** * Comment @@ -203,7 +203,7 @@ abstract class TaskAbstract * * @since 1.0.0 */ - public function getNextRunTime() + public function getNextRunTime() : \DateTime { return $this->nextRunTime; } @@ -229,7 +229,7 @@ abstract class TaskAbstract * * @since 1.0.0 */ - public function getLastRuntime() + public function getLastRuntime() : \DateTime { return $this->lastRunTime; }