Require phpstan and correct issues found up to level 2

* issues found by phpstan L0
* issues found by phpstan L1
* issues found by phpstan L2 in src/
* issues found by phpstan L2 in tests/
This commit is contained in:
Martin Hujer
2017-11-10 10:36:50 +01:00
committed by Ben Ramsey
parent 1eccd070c2
commit ca2629767d
23 changed files with 106 additions and 37 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ class BinaryUtils
/**
* Applies the RFC 4122 variant field to the `clock_seq_hi_and_reserved` field
*
* @param $clockSeqHi
* @param int $clockSeqHi
* @return int The high field of the clock sequence multiplexed with the variant
* @link http://tools.ietf.org/html/rfc4122#section-4.1.1
*/
+1 -1
View File
@@ -36,7 +36,7 @@ class PhpTimeConverter implements TimeConverterInterface
{
// 0x01b21dd213814000 is the number of 100-ns intervals between the
// UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
$uuidTime = ($seconds * 10000000) + ($microSeconds * 10) + 0x01b21dd213814000;
$uuidTime = ((int) $seconds * 10000000) + ((int) $microSeconds * 10) + 0x01b21dd213814000;
return [
'low' => sprintf('%08x', $uuidTime & 0xffffffff),
+1 -1
View File
@@ -283,7 +283,7 @@ class FeatureSet
* Determines which time converter to use and returns the configured
* time converter for this environment
*
* @return TimeConverterInterface
* @return \Ramsey\Uuid\Converter\TimeConverterInterface
*/
protected function buildTimeConverter()
{
+1 -1
View File
@@ -33,7 +33,7 @@ class FixedTimeProvider implements TimeProviderInterface
/**
* Constructs a `FixedTimeProvider` using the provided `$timestamp`
*
* @param int[] Array containing `sec` and `usec` components of a timestamp
* @param int[] $timestamp Array containing `sec` and `usec` components of a timestamp
* @throws InvalidArgumentException if the `$timestamp` does not contain `sec` or `usec` components
*/
public function __construct(array $timestamp)
+1
View File
@@ -238,6 +238,7 @@ class Uuid implements UuidInterface
*/
public function unserialize($serialized)
{
/** @var \Ramsey\Uuid\Uuid $uuid */
$uuid = self::fromString($serialized);
$this->codec = $uuid->codec;
$this->converter = $uuid->converter;