mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-25 17:45:35 +03:00
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:
+27
-1
@@ -123,6 +123,7 @@ class UuidTest extends TestCase
|
||||
*/
|
||||
public function testGetClockSeqHiAndReserved()
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertEquals(155, $uuid->getClockSeqHiAndReserved());
|
||||
}
|
||||
@@ -131,6 +132,7 @@ class UuidTest extends TestCase
|
||||
*/
|
||||
public function testGetClockSeqHiAndReservedHex()
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertEquals('9b', $uuid->getClockSeqHiAndReservedHex());
|
||||
}
|
||||
@@ -139,6 +141,7 @@ class UuidTest extends TestCase
|
||||
*/
|
||||
public function testGetClockSeqLow()
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertEquals(33, $uuid->getClockSeqLow());
|
||||
}
|
||||
@@ -147,6 +150,7 @@ class UuidTest extends TestCase
|
||||
*/
|
||||
public function testGetClockSeqLowHex()
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertEquals('21', $uuid->getClockSeqLowHex());
|
||||
}
|
||||
@@ -155,6 +159,7 @@ class UuidTest extends TestCase
|
||||
*/
|
||||
public function testGetClockSequence()
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertEquals(6945, $uuid->getClockSequence());
|
||||
}
|
||||
@@ -163,6 +168,7 @@ class UuidTest extends TestCase
|
||||
*/
|
||||
public function testGetClockSequenceHex()
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertEquals('1b21', $uuid->getClockSequenceHex());
|
||||
}
|
||||
@@ -260,6 +266,7 @@ class UuidTest extends TestCase
|
||||
'node' => 8796630719078,
|
||||
];
|
||||
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
|
||||
$this->assertEquals($fields, $uuid->getFields());
|
||||
@@ -269,6 +276,7 @@ class UuidTest extends TestCase
|
||||
{
|
||||
Uuid::setFactory(new UuidFactory(new FeatureSet(false, true)));
|
||||
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
|
||||
$this->expectException(UnsatisfiedDependencyException::class);
|
||||
@@ -300,6 +308,7 @@ class UuidTest extends TestCase
|
||||
{
|
||||
$this->skipIfNoMoontoastMath();
|
||||
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertInstanceOf('Moontoast\Math\BigNumber', $uuid->getLeastSignificantBits());
|
||||
$this->assertEquals('11178224546741000806', $uuid->getLeastSignificantBits()->getValue());
|
||||
@@ -309,6 +318,7 @@ class UuidTest extends TestCase
|
||||
{
|
||||
Uuid::setFactory(new UuidFactory(new FeatureSet(false, false, true)));
|
||||
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
|
||||
$this->expectException(UnsatisfiedDependencyException::class);
|
||||
@@ -330,6 +340,7 @@ class UuidTest extends TestCase
|
||||
{
|
||||
$this->skipIfNoMoontoastMath();
|
||||
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertInstanceOf('Moontoast\Math\BigNumber', $uuid->getMostSignificantBits());
|
||||
$this->assertEquals('18406084892941947361', $uuid->getMostSignificantBits()->getValue());
|
||||
@@ -339,6 +350,7 @@ class UuidTest extends TestCase
|
||||
{
|
||||
Uuid::setFactory(new UuidFactory(new FeatureSet(false, false, true)));
|
||||
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
|
||||
$this->expectException(UnsatisfiedDependencyException::class);
|
||||
@@ -360,6 +372,7 @@ class UuidTest extends TestCase
|
||||
{
|
||||
$this->skip64BitTest();
|
||||
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertEquals(8796630719078, $uuid->getNode());
|
||||
}
|
||||
@@ -368,6 +381,7 @@ class UuidTest extends TestCase
|
||||
{
|
||||
Uuid::setFactory(new UuidFactory(new FeatureSet(false, true)));
|
||||
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
|
||||
$this->expectException(UnsatisfiedDependencyException::class);
|
||||
@@ -387,6 +401,7 @@ class UuidTest extends TestCase
|
||||
*/
|
||||
public function testGetTimeHiAndVersion()
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertEquals(4577, $uuid->getTimeHiAndVersion());
|
||||
}
|
||||
@@ -405,6 +420,7 @@ class UuidTest extends TestCase
|
||||
{
|
||||
$this->skip64BitTest();
|
||||
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertEquals(4285500592, $uuid->getTimeLow());
|
||||
}
|
||||
@@ -413,6 +429,7 @@ class UuidTest extends TestCase
|
||||
{
|
||||
Uuid::setFactory(new UuidFactory(new FeatureSet(false, true)));
|
||||
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
|
||||
$this->expectException(UnsatisfiedDependencyException::class);
|
||||
@@ -432,6 +449,7 @@ class UuidTest extends TestCase
|
||||
*/
|
||||
public function testGetTimeMid()
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertEquals(50557, $uuid->getTimeMid());
|
||||
}
|
||||
@@ -451,10 +469,12 @@ class UuidTest extends TestCase
|
||||
$this->skip64BitTest();
|
||||
|
||||
// Check for a recent date
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertEquals(135606608744910000, $uuid->getTimestamp());
|
||||
|
||||
// Check for an old date
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('0901e600-0154-1000-9b21-0800200c9a66');
|
||||
$this->assertEquals(1460440000000, $uuid->getTimestamp());
|
||||
}
|
||||
@@ -475,6 +495,7 @@ class UuidTest extends TestCase
|
||||
public function testGetTimestampFromNonVersion1Uuid()
|
||||
{
|
||||
// Using a version 4 UUID to test
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('bf17b594-41f2-474f-bf70-4c90220f75de');
|
||||
|
||||
$this->expectException(UnsupportedOperationException::class);
|
||||
@@ -498,6 +519,7 @@ class UuidTest extends TestCase
|
||||
{
|
||||
Uuid::setFactory(new UuidFactory(new FeatureSet(false, true)));
|
||||
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
|
||||
$this->expectException(UnsatisfiedDependencyException::class);
|
||||
@@ -653,6 +675,7 @@ class UuidTest extends TestCase
|
||||
{
|
||||
$this->skip64BitTest();
|
||||
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::uuid1(0x0800200c9a66, 0x1669);
|
||||
$this->assertInstanceOf('\Ramsey\Uuid\Uuid', $uuid);
|
||||
$this->assertInstanceOf('\DateTime', $uuid->getDateTime());
|
||||
@@ -667,6 +690,7 @@ class UuidTest extends TestCase
|
||||
*/
|
||||
public function testUuid1WithHexadecimalNode()
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::uuid1('7160355e');
|
||||
|
||||
$this->assertInstanceOf('\Ramsey\Uuid\Uuid', $uuid);
|
||||
@@ -684,6 +708,7 @@ class UuidTest extends TestCase
|
||||
*/
|
||||
public function testUuid1WithMixedCaseHexadecimalNode()
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::uuid1('71B0aD5e');
|
||||
|
||||
$this->assertInstanceOf('\Ramsey\Uuid\Uuid', $uuid);
|
||||
@@ -701,6 +726,7 @@ class UuidTest extends TestCase
|
||||
*/
|
||||
public function testUuid1WithNodeAndClockSequence32Bit()
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::uuid1(0x7fffffff, 0x1669);
|
||||
$this->assertInstanceOf('\Ramsey\Uuid\Uuid', $uuid);
|
||||
$this->assertInstanceOf('\DateTime', $uuid->getDateTime());
|
||||
@@ -973,7 +999,7 @@ class UuidTest extends TestCase
|
||||
$this->assertEquals(-1, $uuid3->compareTo($uuid4));
|
||||
$this->assertEquals(1, $uuid4->compareTo($uuid3));
|
||||
$this->assertEquals(-1, $uuid5->compareTo($uuid3));
|
||||
$this->assertEquals(1, $uuid3->compareto($uuid5));
|
||||
$this->assertEquals(1, $uuid3->compareTo($uuid5));
|
||||
}
|
||||
|
||||
public function testCompareToReturnsZeroWhenDifferentCases()
|
||||
|
||||
Reference in New Issue
Block a user