diff --git a/tests/BelongsToOneTest.php b/tests/BelongsToOneTest.php index c57115d..1932201 100644 --- a/tests/BelongsToOneTest.php +++ b/tests/BelongsToOneTest.php @@ -23,6 +23,7 @@ public function testEagerLoading(): void ->attach(User::query()->create([]), [ 'status' => 1, ]); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Group $group */ $group = Group::query()->with(['leader'])->findOrFail($group->getKey()); self::assertInstanceOf(User::class, $group->leader); @@ -76,6 +77,7 @@ public function testOfMany(): void ->attach($group, [ 'status' => 1, ]); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Group $group */ $group = Group::query()->findOrFail($group->getKey()); self::assertSame('leader', $group->leader()->getRelationName()); @@ -104,10 +106,11 @@ public function testRetrievedTimes(): void ) use (&$retrievedLogins): void { foreach ($models as $model) { if ($model instanceof \Zing\LaravelEloquentRelationships\Tests\Models\User) { - $retrievedLogins++; + ++$retrievedLogins; } } }); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Group $group */ $group = Group::query()->create([ 'name' => $this->faker->name(), @@ -151,6 +154,7 @@ public function testReceivingModel(): void ->create([], [ 'status' => 1, ]); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\User $leader */ $leader = $group->leader; $this->assertNotNull($leader); diff --git a/tests/MorphToOneTest.php b/tests/MorphToOneTest.php index 0e0a037..26937eb 100644 --- a/tests/MorphToOneTest.php +++ b/tests/MorphToOneTest.php @@ -23,9 +23,11 @@ public function testEagerLoading(): void ->attach(Image::query()->create([ 'url' => $url, ]), []); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Product $product */ $product = Product::query()->with(['cover'])->findOrFail($product->getKey()); self::assertInstanceOf(Image::class, $product->cover); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Image $cover */ $cover = $product->cover; self::assertSame($url, $cover->url); @@ -40,6 +42,7 @@ public function testLazyLoading(): void 'url' => $url, ]), []); self::assertInstanceOf(Image::class, $product->cover); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Image $cover */ $cover = $product->cover; self::assertSame($url, $cover->url); @@ -51,6 +54,7 @@ public function testWithDefault(): void 'name' => 'test', ]); self::assertInstanceOf(Image::class, $product->cover); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Image $cover */ $cover = $product->cover; self::assertSame('https://example.com/default.png', $cover->url); @@ -74,6 +78,7 @@ public function testOfMany(): void $product = Product::query()->create([]); $image->bestProduct() ->attach($product, []); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Product $product */ $product = Product::query()->findOrFail($image->getKey()); self::assertSame('cover', $product->cover()->getRelationName()); @@ -102,7 +107,7 @@ public function testRetrievedTimes(): void ) use (&$retrievedLogins): void { foreach ($models as $model) { if ($model instanceof \Zing\LaravelEloquentRelationships\Tests\Models\Image) { - $retrievedLogins++; + ++$retrievedLogins; } } }); @@ -149,6 +154,7 @@ public function testReceivingModel(): void ->create([ 'url' => 'test', ]); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Image $cover */ $cover = $product->cover; $this->assertNotNull($cover); @@ -177,6 +183,7 @@ public function testMorphType(): void ->updateExistingPivot($image->getKey(), [ 'imageable_type' => 'bar', ]); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Image $cover */ $cover = $product->cover; $this->assertNotNull($cover); diff --git a/tests/MorphedByOneTest.php b/tests/MorphedByOneTest.php index f943c72..42a797e 100644 --- a/tests/MorphedByOneTest.php +++ b/tests/MorphedByOneTest.php @@ -28,6 +28,7 @@ public function testEagerLoading(): void ->attach(Image::query()->create([ 'url' => $url, ]), []); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Image $image */ $image = Image::query()->with(['bestProduct'])->findOrFail($product->getKey()); self::assertInstanceOf(Product::class, $image->bestProduct); @@ -43,6 +44,7 @@ public function testLazyLoading(): void ->attach(Image::query()->create([ 'url' => $url, ]), []); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Image $image */ $image = Image::query()->findOrFail($product->getKey()); self::assertInstanceOf(Product::class, $image->bestProduct); @@ -77,6 +79,7 @@ public function testOfMany(): void ]); $product->images() ->attach($image, []); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Image $image */ $image = Image::query()->findOrFail($product->getKey()); self::assertSame('bestProduct', $image->bestProduct()->getRelationName()); @@ -103,7 +106,7 @@ public function testRetrievedTimes(): void ) use (&$retrievedLogins): void { foreach ($models as $model) { if ($model instanceof \Zing\LaravelEloquentRelationships\Tests\Models\Product) { - $retrievedLogins++; + ++$retrievedLogins; } } }); @@ -142,6 +145,7 @@ public function testReceivingModel(): void ->create([ 'name' => 'test', ]); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Product $product */ $product = $image->bestProduct; $this->assertNotNull($product); @@ -170,6 +174,7 @@ public function testMorphType(): void ->updateExistingPivot($product->getKey(), [ 'imageable_type' => 'bar', ]); + /** @var \Zing\LaravelEloquentRelationships\Tests\Models\Product $product */ $product = $image->bestProduct; $this->assertNotNull($product);