From b3c26661ca162a3eb7dfdecd60df11fc1dea57dc Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Wed, 4 Mar 2020 16:51:46 -0600 Subject: [PATCH] Correct capitalization of microsecond --- CHANGELOG.md | 2 +- src/Converter/Time/BigNumberTimeConverter.php | 4 +- src/Converter/Time/GenericTimeConverter.php | 6 +-- src/Converter/Time/PhpTimeConverter.php | 8 ++-- src/Converter/TimeConverterInterface.php | 4 +- src/DeprecatedUuidMethodsTrait.php | 2 +- src/Generator/DefaultTimeGenerator.php | 2 +- src/Nonstandard/UuidV6.php | 2 +- src/Provider/Time/FixedTimeProvider.php | 2 +- src/Rfc4122/UuidV1.php | 2 +- src/Rfc4122/UuidV2.php | 2 +- src/Type/Time.php | 16 ++++---- .../Time/BigNumberTimeConverterTest.php | 8 ++-- .../Time/GenericTimeConverterTest.php | 24 +++++------ tests/Converter/Time/PhpTimeConverterTest.php | 32 +++++++-------- tests/ExpectedBehaviorTest.php | 4 +- tests/Provider/Time/FixedTimeProviderTest.php | 6 +-- tests/Type/TimeTest.php | 40 +++++++++---------- 18 files changed, 83 insertions(+), 83 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a49ac93..f366e18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -233,7 +233,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. instead of `mixed`; this simplifies the interface and makes it consistent: * `NumberConverterInterface::fromHex(string $hex): string` * `NumberConverterInterface::toHex(string $number): string` - * `TimeConverterInterface::calculateTime(string $seconds, string $microSeconds): array` + * `TimeConverterInterface::calculateTime(string $seconds, string $microseconds): array` * `UnsupportedOperationException` is now descended from `\LogicException`. Previously, it descended from `\RuntimeException`. * When encoding to bytes or decoding from bytes, `OrderedTimeCodec` now checks diff --git a/src/Converter/Time/BigNumberTimeConverter.php b/src/Converter/Time/BigNumberTimeConverter.php index 97e60c4..7a24332 100644 --- a/src/Converter/Time/BigNumberTimeConverter.php +++ b/src/Converter/Time/BigNumberTimeConverter.php @@ -41,9 +41,9 @@ class BigNumberTimeConverter implements TimeConverterInterface * @inheritDoc * @psalm-pure */ - public function calculateTime(string $seconds, string $microSeconds): Hexadecimal + public function calculateTime(string $seconds, string $microseconds): Hexadecimal { - return $this->converter->calculateTime($seconds, $microSeconds); + return $this->converter->calculateTime($seconds, $microseconds); } /** diff --git a/src/Converter/Time/GenericTimeConverter.php b/src/Converter/Time/GenericTimeConverter.php index 8b37dfa..0cd4373 100644 --- a/src/Converter/Time/GenericTimeConverter.php +++ b/src/Converter/Time/GenericTimeConverter.php @@ -62,9 +62,9 @@ class GenericTimeConverter implements TimeConverterInterface * @inheritDoc * @psalm-pure */ - public function calculateTime(string $seconds, string $microSeconds): Hexadecimal + public function calculateTime(string $seconds, string $microseconds): Hexadecimal { - $timestamp = new Time($seconds, $microSeconds); + $timestamp = new Time($seconds, $microseconds); // Convert the seconds into a count of 100-nanosecond intervals. $sec = $this->calculator->multiply( @@ -74,7 +74,7 @@ class GenericTimeConverter implements TimeConverterInterface // Convert the microseconds into a count of 100-nanosecond intervals. $usec = $this->calculator->multiply( - $timestamp->getMicroSeconds(), + $timestamp->getMicroseconds(), new IntegerObject(self::MICROSECOND_INTERVALS) ); diff --git a/src/Converter/Time/PhpTimeConverter.php b/src/Converter/Time/PhpTimeConverter.php index 353fe77..98654b3 100644 --- a/src/Converter/Time/PhpTimeConverter.php +++ b/src/Converter/Time/PhpTimeConverter.php @@ -92,15 +92,15 @@ class PhpTimeConverter implements TimeConverterInterface * @inheritDoc * @psalm-pure */ - public function calculateTime(string $seconds, string $microSeconds): Hexadecimal + public function calculateTime(string $seconds, string $microseconds): Hexadecimal { $seconds = new IntegerObject($seconds); - $microSeconds = new IntegerObject($microSeconds); + $microseconds = new IntegerObject($microseconds); // Calculate the count of 100-nanosecond intervals since the Gregorian // calendar epoch for the given seconds and microseconds. $uuidTime = ((int) $seconds->toString() * self::SECOND_INTERVALS) - + ((int) $microSeconds->toString() * self::MICROSECOND_INTERVALS) + + ((int) $microseconds->toString() * self::MICROSECOND_INTERVALS) + self::GREGORIAN_TO_UNIX_INTERVALS; // Check to see whether we've overflowed the max/min integer size. @@ -108,7 +108,7 @@ class PhpTimeConverter implements TimeConverterInterface if (!is_int($uuidTime)) { return $this->fallbackConverter->calculateTime( $seconds->toString(), - $microSeconds->toString() + $microseconds->toString() ); } diff --git a/src/Converter/TimeConverterInterface.php b/src/Converter/TimeConverterInterface.php index e0d763d..c9abac0 100644 --- a/src/Converter/TimeConverterInterface.php +++ b/src/Converter/TimeConverterInterface.php @@ -32,14 +32,14 @@ interface TimeConverterInterface * * @param string $seconds A string representation of the number of seconds * since the Unix epoch for the time to calculate - * @param string $microSeconds A string representation of the micro-seconds + * @param string $microseconds A string representation of the micro-seconds * associated with the time to calculate * * @return Hexadecimal The full UUID timestamp as a Hexadecimal value * * @psalm-pure */ - public function calculateTime(string $seconds, string $microSeconds): Hexadecimal; + public function calculateTime(string $seconds, string $microseconds): Hexadecimal; /** * Converts a timestamp extracted from a UUID to a Unix timestamp diff --git a/src/DeprecatedUuidMethodsTrait.php b/src/DeprecatedUuidMethodsTrait.php index d1a3b9a..3428295 100644 --- a/src/DeprecatedUuidMethodsTrait.php +++ b/src/DeprecatedUuidMethodsTrait.php @@ -148,7 +148,7 @@ trait DeprecatedUuidMethodsTrait '@' . $time->getSeconds()->toString() . '.' - . str_pad($time->getMicroSeconds()->toString(), 6, '0', STR_PAD_LEFT) + . str_pad($time->getMicroseconds()->toString(), 6, '0', STR_PAD_LEFT) ); } catch (Throwable $e) { throw new DateTimeException($e->getMessage(), (int) $e->getCode(), $e); diff --git a/src/Generator/DefaultTimeGenerator.php b/src/Generator/DefaultTimeGenerator.php index 79989f0..d245c7b 100644 --- a/src/Generator/DefaultTimeGenerator.php +++ b/src/Generator/DefaultTimeGenerator.php @@ -96,7 +96,7 @@ class DefaultTimeGenerator implements TimeGeneratorInterface $uuidTime = $this->timeConverter->calculateTime( $time->getSeconds()->toString(), - $time->getMicroSeconds()->toString() + $time->getMicroseconds()->toString() ); $timeHex = str_pad($uuidTime->toString(), 16, '0', STR_PAD_LEFT); diff --git a/src/Nonstandard/UuidV6.php b/src/Nonstandard/UuidV6.php index 680d59f..454d04c 100644 --- a/src/Nonstandard/UuidV6.php +++ b/src/Nonstandard/UuidV6.php @@ -87,7 +87,7 @@ final class UuidV6 extends Uuid implements UuidInterface '@' . $time->getSeconds()->toString() . '.' - . str_pad($time->getMicroSeconds()->toString(), 6, '0', STR_PAD_LEFT) + . str_pad($time->getMicroseconds()->toString(), 6, '0', STR_PAD_LEFT) ); } catch (Throwable $e) { throw new DateTimeException($e->getMessage(), (int) $e->getCode(), $e); diff --git a/src/Provider/Time/FixedTimeProvider.php b/src/Provider/Time/FixedTimeProvider.php index b017ee8..b8bfd72 100644 --- a/src/Provider/Time/FixedTimeProvider.php +++ b/src/Provider/Time/FixedTimeProvider.php @@ -53,7 +53,7 @@ class FixedTimeProvider implements TimeProviderInterface */ public function setSec($value): void { - $this->fixedTime = new Time($value, $this->fixedTime->getMicroSeconds()); + $this->fixedTime = new Time($value, $this->fixedTime->getMicroseconds()); } public function getTime(): Time diff --git a/src/Rfc4122/UuidV1.php b/src/Rfc4122/UuidV1.php index 4989915..764e42f 100644 --- a/src/Rfc4122/UuidV1.php +++ b/src/Rfc4122/UuidV1.php @@ -83,7 +83,7 @@ final class UuidV1 extends Uuid implements UuidInterface '@' . $time->getSeconds()->toString() . '.' - . str_pad($time->getMicroSeconds()->toString(), 6, '0', STR_PAD_LEFT) + . str_pad($time->getMicroseconds()->toString(), 6, '0', STR_PAD_LEFT) ); } catch (Throwable $e) { throw new DateTimeException($e->getMessage(), (int) $e->getCode(), $e); diff --git a/src/Rfc4122/UuidV2.php b/src/Rfc4122/UuidV2.php index ae6c442..d134d3b 100644 --- a/src/Rfc4122/UuidV2.php +++ b/src/Rfc4122/UuidV2.php @@ -100,7 +100,7 @@ final class UuidV2 extends Uuid implements UuidInterface '@' . $time->getSeconds()->toString() . '.' - . str_pad($time->getMicroSeconds()->toString(), 6, '0', STR_PAD_LEFT) + . str_pad($time->getMicroseconds()->toString(), 6, '0', STR_PAD_LEFT) ); } catch (Throwable $e) { throw new DateTimeException($e->getMessage(), (int) $e->getCode(), $e); diff --git a/src/Type/Time.php b/src/Type/Time.php index 7e9715e..f6a140f 100644 --- a/src/Type/Time.php +++ b/src/Type/Time.php @@ -40,16 +40,16 @@ final class Time implements TypeInterface /** * @var IntegerObject */ - private $microSeconds; + private $microseconds; /** * @param mixed $seconds - * @param mixed $microSeconds + * @param mixed $microseconds */ - public function __construct($seconds, $microSeconds = 0) + public function __construct($seconds, $microseconds = 0) { $this->seconds = new IntegerObject($seconds); - $this->microSeconds = new IntegerObject($microSeconds); + $this->microseconds = new IntegerObject($microseconds); } public function getSeconds(): IntegerObject @@ -57,14 +57,14 @@ final class Time implements TypeInterface return $this->seconds; } - public function getMicroSeconds(): IntegerObject + public function getMicroseconds(): IntegerObject { - return $this->microSeconds; + return $this->microseconds; } public function toString(): string { - return $this->seconds->toString() . '.' . $this->microSeconds->toString(); + return $this->seconds->toString() . '.' . $this->microseconds->toString(); } public function __toString(): string @@ -79,7 +79,7 @@ final class Time implements TypeInterface { return [ 'seconds' => $this->getSeconds()->toString(), - 'microseconds' => $this->getMicroSeconds()->toString(), + 'microseconds' => $this->getMicroseconds()->toString(), ]; } diff --git a/tests/Converter/Time/BigNumberTimeConverterTest.php b/tests/Converter/Time/BigNumberTimeConverterTest.php index f1703c5..0552a08 100644 --- a/tests/Converter/Time/BigNumberTimeConverterTest.php +++ b/tests/Converter/Time/BigNumberTimeConverterTest.php @@ -17,11 +17,11 @@ class BigNumberTimeConverterTest extends TestCase public function testCalculateTimeReturnsArrayOfTimeSegments(): void { $seconds = BigInteger::of(5); - $microSeconds = BigInteger::of(3); + $microseconds = BigInteger::of(3); $calculatedTime = BigInteger::zero() ->plus($seconds->multipliedBy(10000000)) - ->plus($microSeconds->multipliedBy(10)) + ->plus($microseconds->multipliedBy(10)) ->plus(BigInteger::fromBase('01b21dd213814000', 16)); $maskLow = BigInteger::fromBase('ffffffff', 16); @@ -33,7 +33,7 @@ class BigNumberTimeConverterTest extends TestCase $expected .= sprintf('%08s', $calculatedTime->and($maskLow)->toBase(16)); $converter = new BigNumberTimeConverter(); - $returned = $converter->calculateTime((string) $seconds, (string) $microSeconds); + $returned = $converter->calculateTime((string) $seconds, (string) $microseconds); $this->assertInstanceOf(Hexadecimal::class, $returned); $this->assertSame($expected, $returned->toString()); @@ -60,7 +60,7 @@ class BigNumberTimeConverterTest extends TestCase $converter->calculateTime('12.34', '5678'); } - public function testCalculateTimeThrowsExceptionWhenMicroSecondsIsNotOnlyDigits(): void + public function testCalculateTimeThrowsExceptionWhenMicrosecondsIsNotOnlyDigits(): void { $converter = new BigNumberTimeConverter(); diff --git a/tests/Converter/Time/GenericTimeConverterTest.php b/tests/Converter/Time/GenericTimeConverterTest.php index 19de659..aba4106 100644 --- a/tests/Converter/Time/GenericTimeConverterTest.php +++ b/tests/Converter/Time/GenericTimeConverterTest.php @@ -14,12 +14,12 @@ class GenericTimeConverterTest extends TestCase /** * @dataProvider provideCalculateTime */ - public function testCalculateTime(string $seconds, string $microSeconds, string $expected): void + public function testCalculateTime(string $seconds, string $microseconds, string $expected): void { $calculator = new BrickMathCalculator(); $converter = new GenericTimeConverter($calculator); - $result = $converter->calculateTime($seconds, $microSeconds); + $result = $converter->calculateTime($seconds, $microseconds); $this->assertSame($expected, $result->toString()); } @@ -32,7 +32,7 @@ class GenericTimeConverterTest extends TestCase return [ [ 'seconds' => '-12219146756', - 'microSeconds' => '0', + 'microseconds' => '0', 'expected' => '000001540901e600', ], [ @@ -50,7 +50,7 @@ class GenericTimeConverterTest extends TestCase // 1582-10-15 00:00:00.000000 [ 'seconds' => '-12219292800', - 'microSeconds' => '0', + 'microseconds' => '0', 'expected' => '0000000000000000', ], @@ -82,7 +82,7 @@ class GenericTimeConverterTest extends TestCase /** * @dataProvider provideConvertTime */ - public function testConvertTime(Hexadecimal $uuidTimestamp, string $unixTimestamp, string $microSeconds): void + public function testConvertTime(Hexadecimal $uuidTimestamp, string $unixTimestamp, string $microseconds): void { $calculator = new BrickMathCalculator(); $converter = new GenericTimeConverter($calculator); @@ -90,7 +90,7 @@ class GenericTimeConverterTest extends TestCase $result = $converter->convertTime($uuidTimestamp); $this->assertSame($unixTimestamp, $result->getSeconds()->toString()); - $this->assertSame($microSeconds, $result->getMicroSeconds()->toString()); + $this->assertSame($microseconds, $result->getMicroseconds()->toString()); } /** @@ -102,17 +102,17 @@ class GenericTimeConverterTest extends TestCase [ 'uuidTimestamp' => new Hexadecimal('1e1c57dff6f8cb0'), 'unixTimestamp' => '1341368074', - 'microSeconds' => '491000', + 'microseconds' => '491000', ], [ 'uuidTimestamp' => new Hexadecimal('1ea333764c71df6'), 'unixTimestamp' => '1578612359', - 'microSeconds' => '521023', + 'microseconds' => '521023', ], [ 'uuidTimestamp' => new Hexadecimal('fffffffff9785f6'), 'unixTimestamp' => '103072857659', - 'microSeconds' => '999999', + 'microseconds' => '999999', ], // This is the last possible time supported by v1 UUIDs. When @@ -121,7 +121,7 @@ class GenericTimeConverterTest extends TestCase [ 'uuidTimestamp' => new Hexadecimal('fffffffffffffffa'), 'unixTimestamp' => '1832455114570', - 'microSeconds' => '955161', + 'microseconds' => '955161', ], // This is the earliest possible date supported by v1 UUIDs: @@ -129,7 +129,7 @@ class GenericTimeConverterTest extends TestCase [ 'uuidTimestamp' => new Hexadecimal('000000000000'), 'unixTimestamp' => '-12219292800', - 'microSeconds' => '0', + 'microseconds' => '0', ], // This is the Unix epoch: @@ -137,7 +137,7 @@ class GenericTimeConverterTest extends TestCase [ 'uuidTimestamp' => new Hexadecimal('1b21dd213814000'), 'unixTimestamp' => '0', - 'microSeconds' => '0', + 'microseconds' => '0', ], ]; } diff --git a/tests/Converter/Time/PhpTimeConverterTest.php b/tests/Converter/Time/PhpTimeConverterTest.php index eae5599..f3209b0 100644 --- a/tests/Converter/Time/PhpTimeConverterTest.php +++ b/tests/Converter/Time/PhpTimeConverterTest.php @@ -20,11 +20,11 @@ class PhpTimeConverterTest extends TestCase public function testCalculateTimeReturnsArrayOfTimeSegments(): void { $seconds = BigInteger::of(5); - $microSeconds = BigInteger::of(3); + $microseconds = BigInteger::of(3); $calculatedTime = BigInteger::zero() ->plus($seconds->multipliedBy(10000000)) - ->plus($microSeconds->multipliedBy(10)) + ->plus($microseconds->multipliedBy(10)) ->plus(BigInteger::fromBase('01b21dd213814000', 16)); $maskLow = BigInteger::fromBase('ffffffff', 16); @@ -36,7 +36,7 @@ class PhpTimeConverterTest extends TestCase $expected .= sprintf('%08s', $calculatedTime->and($maskLow)->toBase(16)); $converter = new PhpTimeConverter(); - $returned = $converter->calculateTime((string) $seconds, (string) $microSeconds); + $returned = $converter->calculateTime((string) $seconds, (string) $microseconds); $this->assertSame($expected, $returned->toString()); } @@ -55,7 +55,7 @@ class PhpTimeConverterTest extends TestCase $converter->calculateTime('12.34', '5678'); } - public function testCalculateTimeThrowsExceptionWhenMicroSecondsIsNotOnlyDigits(): void + public function testCalculateTimeThrowsExceptionWhenMicrosecondsIsNotOnlyDigits(): void { /** @var Mockery\MockInterface & PhpTimeConverter $converter */ $converter = Mockery::mock(PhpTimeConverter::class)->makePartial(); @@ -72,7 +72,7 @@ class PhpTimeConverterTest extends TestCase /** * @dataProvider provideConvertTime */ - public function testConvertTime(Hexadecimal $uuidTimestamp, string $unixTimestamp, string $microSeconds): void + public function testConvertTime(Hexadecimal $uuidTimestamp, string $unixTimestamp, string $microseconds): void { $calculator = new BrickMathCalculator(); $fallbackConverter = new GenericTimeConverter($calculator); @@ -81,7 +81,7 @@ class PhpTimeConverterTest extends TestCase $result = $converter->convertTime($uuidTimestamp); $this->assertSame($unixTimestamp, $result->getSeconds()->toString()); - $this->assertSame($microSeconds, $result->getMicroSeconds()->toString()); + $this->assertSame($microseconds, $result->getMicroseconds()->toString()); } /** @@ -93,17 +93,17 @@ class PhpTimeConverterTest extends TestCase [ 'uuidTimestamp' => new Hexadecimal('1e1c57dff6f8cb0'), 'unixTimestamp' => '1341368074', - 'microSeconds' => '491000', + 'microseconds' => '491000', ], [ 'uuidTimestamp' => new Hexadecimal('1ea333764c71df6'), 'unixTimestamp' => '1578612359', - 'microSeconds' => '521023', + 'microseconds' => '521023', ], [ 'uuidTimestamp' => new Hexadecimal('fffffffff9785f6'), 'unixTimestamp' => '103072857659', - 'microSeconds' => '999999', + 'microseconds' => '999999', ], // This is the last possible time supported by v1 UUIDs. When @@ -112,7 +112,7 @@ class PhpTimeConverterTest extends TestCase [ 'uuidTimestamp' => new Hexadecimal('fffffffffffffffa'), 'unixTimestamp' => '1832455114570', - 'microSeconds' => '955161', + 'microseconds' => '955161', ], // This is the earliest possible date supported by v1 UUIDs: @@ -120,7 +120,7 @@ class PhpTimeConverterTest extends TestCase [ 'uuidTimestamp' => new Hexadecimal('000000000000'), 'unixTimestamp' => '-12219292800', - 'microSeconds' => '0', + 'microseconds' => '0', ], // This is the Unix epoch: @@ -128,7 +128,7 @@ class PhpTimeConverterTest extends TestCase [ 'uuidTimestamp' => new Hexadecimal('1b21dd213814000'), 'unixTimestamp' => '0', - 'microSeconds' => '0', + 'microseconds' => '0', ], ]; } @@ -136,13 +136,13 @@ class PhpTimeConverterTest extends TestCase /** * @dataProvider provideCalculateTime */ - public function testCalculateTime(string $seconds, string $microSeconds, string $expected): void + public function testCalculateTime(string $seconds, string $microseconds, string $expected): void { $calculator = new BrickMathCalculator(); $fallbackConverter = new GenericTimeConverter($calculator); $converter = new PhpTimeConverter($calculator, $fallbackConverter); - $result = $converter->calculateTime($seconds, $microSeconds); + $result = $converter->calculateTime($seconds, $microseconds); $this->assertSame($expected, $result->toString()); } @@ -155,7 +155,7 @@ class PhpTimeConverterTest extends TestCase return [ [ 'seconds' => '-12219146756', - 'microSeconds' => '0', + 'microseconds' => '0', 'expected' => '000001540901e600', ], [ @@ -173,7 +173,7 @@ class PhpTimeConverterTest extends TestCase // 1582-10-15 00:00:00.000000 [ 'seconds' => '-12219292800', - 'microSeconds' => '0', + 'microseconds' => '0', 'expected' => '0000000000000000', ], diff --git a/tests/ExpectedBehaviorTest.php b/tests/ExpectedBehaviorTest.php index 18e20a3..c474c06 100644 --- a/tests/ExpectedBehaviorTest.php +++ b/tests/ExpectedBehaviorTest.php @@ -532,8 +532,8 @@ class ExpectedBehaviorTest extends TestCase $timeConverter = \Mockery::mock('Ramsey\Uuid\Converter\TimeConverterInterface'); $timeConverter ->shouldReceive('calculateTime') - ->andReturnUsing(function ($seconds, $microSeconds) { - return new Hexadecimal('abcd' . dechex($microSeconds) . dechex($seconds)); + ->andReturnUsing(function ($seconds, $microseconds) { + return new Hexadecimal('abcd' . dechex($microseconds) . dechex($seconds)); }); $timeProvider = \Mockery::mock('Ramsey\Uuid\Provider\TimeProviderInterface', [ diff --git a/tests/Provider/Time/FixedTimeProviderTest.php b/tests/Provider/Time/FixedTimeProviderTest.php index 1720848..f7e6b2a 100644 --- a/tests/Provider/Time/FixedTimeProviderTest.php +++ b/tests/Provider/Time/FixedTimeProviderTest.php @@ -24,17 +24,17 @@ class FixedTimeProviderTest extends TestCase $provider = new FixedTimeProvider($time); $this->assertSame('1458844556', $provider->getTime()->getSeconds()->toString()); - $this->assertSame('200997', $provider->getTime()->getMicroSeconds()->toString()); + $this->assertSame('200997', $provider->getTime()->getMicroseconds()->toString()); $provider->setSec(1050804050); $this->assertSame('1050804050', $provider->getTime()->getSeconds()->toString()); - $this->assertSame('200997', $provider->getTime()->getMicroSeconds()->toString()); + $this->assertSame('200997', $provider->getTime()->getMicroseconds()->toString()); $provider->setUsec(30192); $this->assertSame('1050804050', $provider->getTime()->getSeconds()->toString()); - $this->assertSame('30192', $provider->getTime()->getMicroSeconds()->toString()); + $this->assertSame('30192', $provider->getTime()->getMicroseconds()->toString()); $this->assertNotSame($time, $provider->getTime()); } diff --git a/tests/Type/TimeTest.php b/tests/Type/TimeTest.php index 3fbba6e..a81b43f 100644 --- a/tests/Type/TimeTest.php +++ b/tests/Type/TimeTest.php @@ -16,18 +16,18 @@ class TimeTest extends TestCase { /** * @param int|float|string $seconds - * @param int|float|string|null $microSeconds + * @param int|float|string|null $microseconds * * @dataProvider provideTimeValues */ - public function testTime($seconds, $microSeconds): void + public function testTime($seconds, $microseconds): void { $params = [$seconds]; $timeString = (string) $seconds; - if ($microSeconds !== null) { - $params[] = $microSeconds; - $timeString .= ".{$microSeconds}"; + if ($microseconds !== null) { + $params[] = $microseconds; + $timeString .= ".{$microseconds}"; } else { $timeString .= '.0'; } @@ -37,8 +37,8 @@ class TimeTest extends TestCase $this->assertSame((string) $seconds, $time->getSeconds()->toString()); $this->assertSame( - (string) $microSeconds ?: '0', - $time->getMicroSeconds()->toString() + (string) $microseconds ?: '0', + $time->getMicroseconds()->toString() ); $this->assertSame($timeString, (string) $time); @@ -52,26 +52,26 @@ class TimeTest extends TestCase return [ [ 'seconds' => 103072857659, - 'microSeconds' => null, + 'microseconds' => null, ], [ 'seconds' => -12219292800, - 'microSeconds' => 1234, + 'microseconds' => 1234, ], ]; } /** * @param int|float|string $seconds - * @param int|float|string|null $microSeconds + * @param int|float|string|null $microseconds * * @dataProvider provideTimeValues */ - public function testSerializeUnserializeTime($seconds, $microSeconds): void + public function testSerializeUnserializeTime($seconds, $microseconds): void { $params = [$seconds]; - if ($microSeconds !== null) { - $params[] = $microSeconds; + if ($microseconds !== null) { + $params[] = $microseconds; } $time = new Time(...$params); @@ -81,8 +81,8 @@ class TimeTest extends TestCase $this->assertSame((string) $seconds, $unserializedTime->getSeconds()->toString()); $this->assertSame( - (string) $microSeconds ?: '0', - $unserializedTime->getMicroSeconds()->toString() + (string) $microseconds ?: '0', + $unserializedTime->getMicroseconds()->toString() ); } @@ -98,22 +98,22 @@ class TimeTest extends TestCase /** * @param int|float|string $seconds - * @param int|float|string|null $microSeconds + * @param int|float|string|null $microseconds * * @dataProvider provideTimeValues */ - public function testJsonSerialize($seconds, $microSeconds): void + public function testJsonSerialize($seconds, $microseconds): void { $time = [ 'seconds' => (string) $seconds, - 'microseconds' => (string) $microSeconds ?: '0', + 'microseconds' => (string) $microseconds ?: '0', ]; $expectedJson = json_encode($time); $params = [$seconds]; - if ($microSeconds !== null) { - $params[] = $microSeconds; + if ($microseconds !== null) { + $params[] = $microseconds; } $time = new Time(...$params);