From 3b1b5ff36f4795475fd6efc0acb1d9692351dafc Mon Sep 17 00:00:00 2001 From: JoaoFerrazfs Date: Wed, 2 Oct 2024 11:45:45 -0300 Subject: [PATCH] refactor: added schema changes --- src/Schema/Schema.php | 6 ++++-- tests/Unit/Schema/SchemaTest.php | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Schema/Schema.php b/src/Schema/Schema.php index f7036140..002ae4c2 100644 --- a/src/Schema/Schema.php +++ b/src/Schema/Schema.php @@ -4,6 +4,7 @@ namespace Mongolid\Schema; +use Illuminate\Contracts\Container\BindingResolutionException; use MongoDB\BSON\ObjectId; use MongoDB\BSON\UTCDateTime; use Mongolid\Container\Container; @@ -53,8 +54,8 @@ abstract class Schema public string $entityClass = 'stdClass'; /** - * Filters any field in the $fields that has it's value specified as a - * 'objectId'. It will wraps the $value, if any, into a ObjectId object. + * Filters any field in the $fields that has its value specified as a + * 'objectId'. It will wrap the $value, if any, into a ObjectId object. * * @param mixed $value value that may be converted to ObjectId */ @@ -77,6 +78,7 @@ public function objectId(mixed $value = null): mixed * the schema. The sequence generation is done by the SequenceService. * * @param int|null $value value that will be evaluated + * @throws BindingResolutionException */ public function sequence(?int $value = null): int { diff --git a/tests/Unit/Schema/SchemaTest.php b/tests/Unit/Schema/SchemaTest.php index d57b896e..4b003274 100644 --- a/tests/Unit/Schema/SchemaTest.php +++ b/tests/Unit/Schema/SchemaTest.php @@ -145,7 +145,7 @@ public function testShouldRefreshUpdatedAtTimestamps(): void // Arrange $schema = new class extends Schema { }; - $value = (new UTCDateTime(25)); + $value = new UTCDateTime(25); // Assertion $result = $schema->updatedAtTimestamp($value); @@ -157,9 +157,9 @@ public function testShouldRefreshUpdatedAtTimestamps(): void * @dataProvider createdAtTimestampsFixture */ public function testShouldNotRefreshCreatedAtTimestamps( - $value, - $expectation, - $compareTimestamp = true + mixed $value, + UTCDateTime $expectation, + bool $compareTimestamp = true ): void { // Arrange $schema = new class extends Schema {