File tree Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 2323 "orchestra/testbench" : " ^8.0|^9.0|^10.0" ,
2424 "laravel/legacy-factories" : " ^1.0.4" ,
2525 "friendsofphp/php-cs-fixer" : " ^3.13" ,
26- "larastan/larastan" : " ^2.0"
26+ "larastan/larastan" : " ^2.0|^3.0 "
2727 },
2828 "autoload" : {
2929 "psr-4" : {
Original file line number Diff line number Diff line change 44
55use Cesargb \Database \Support \CascadeDelete ;
66use Illuminate \Database \Eloquent \Model ;
7+ use Illuminate \Database \Eloquent \Relations \MorphOne ;
78
89/**
9- * @property \Tests\Models\Image $image
10+ * @property ? \Tests\Models\Image $image
1011 */
1112class User extends Model
1213{
@@ -16,7 +17,7 @@ class User extends Model
1617
1718 protected $ fillable = ['name ' ];
1819
19- public function image ()
20+ public function image (): MorphOne
2021 {
2122 return $ this ->morphOne (Image::class, 'imageable ' );
2223 }
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ public function test_clean_residual_morph_relations_from_model_morph_many()
7575
7676 $ this ->assertEquals (2 , $ numRowsDeleted );
7777 $ this ->assertEquals (2 , Option::count ());
78- $ this ->assertNotNull (2 , Photo::where ('id ' , 1 )->first ()->options ()->count ());
78+ $ this ->assertEquals (2 , Photo::where ('id ' , 1 )->first ()->options ()->count ());
7979 }
8080
8181 public function test_clean_residual_morph_relations_from_model_morph_to_many ()
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ public function test_delete_morph_relations_from_event_model__morph_one()
2222 });
2323
2424 $ this ->assertEquals (2 , Image::count ());
25- $ this ->assertNotNull (User::first ()->image );
25+ $ this ->assertNotNull (User::with ( ' image ' )-> first ()->image );
2626
2727 User::first ()->delete ();
2828
@@ -38,12 +38,12 @@ public function test_delete_morph_relations_from_record_model__morph_one()
3838 });
3939
4040 $ this ->assertEquals (2 , Image::count ());
41- $ this ->assertNotNull (User::first ()->image );
41+ $ this ->assertNotNull (User::with ( ' image ' )-> first ()->image );
4242
4343 (new Morph ())->delete (User::first ());
4444
4545 $ this ->assertEquals (1 , Image::count ());
46- $ this ->assertNull (User::first ()->image );
46+ $ this ->assertNull (User::with ( ' image ' )-> first ()->image );
4747 }
4848
4949 public function test_delete_morph_relations_from_record_model__morph_many ()
You can’t perform that action at this time.
0 commit comments