File tree 5 files changed +13
-7
lines changed
5 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ includes:
7
7
- vendor/phpstan/phpstan-phpunit/rules.neon
8
8
parameters :
9
9
# TODO level up to max
10
- level : 2
10
+ level : 3
11
11
paths :
12
12
- src
13
13
- tests
Original file line number Diff line number Diff line change @@ -19,22 +19,25 @@ public function test_can_set_model_value_using_enum_instance()
19
19
public function test_can_set_model_value_using_enum_value ()
20
20
{
21
21
$ model = new Example ;
22
+ // @phpstan-ignore-next-line loose typing
22
23
$ model ->user_type = UserType::Moderator;
23
24
24
25
$ this ->assertEquals (UserType::Moderator (), $ model ->user_type );
25
26
}
26
27
27
28
public function test_cannot_set_model_value_using_invalid_enum_value ()
28
29
{
29
- $ this ->expectException (InvalidEnumMemberException::class);
30
-
31
30
$ model = new Example ;
31
+
32
+ $ this ->expectException (InvalidEnumMemberException::class);
33
+ // @phpstan-ignore-next-line intentionally wrong
32
34
$ model ->user_type = 5 ;
33
35
}
34
36
35
37
public function test_getting_model_value_returns_enum_instance ()
36
38
{
37
39
$ model = new Example ;
40
+ // @phpstan-ignore-next-line loose typing
38
41
$ model ->user_type = UserType::Moderator;
39
42
40
43
$ this ->assertInstanceOf (UserType::class, $ model ->user_type );
Original file line number Diff line number Diff line change 6
6
use Illuminate \Database \Eloquent \Model ;
7
7
8
8
/**
9
- * @property UserType $user_type
9
+ * @property UserType|null $user_type
10
10
*/
11
11
class Example extends Model
12
12
{
Original file line number Diff line number Diff line change 7
7
use Illuminate \Database \Eloquent \Model ;
8
8
9
9
/**
10
- * @property UserType $user_type
10
+ * @property UserType|null $user_type
11
11
* @property UserTypeCustomCast $user_type_custom
12
12
*/
13
13
class NativeCastModel extends Model
Original file line number Diff line number Diff line change @@ -21,22 +21,25 @@ public function test_can_set_model_value_using_enum_instance()
21
21
public function test_can_set_model_value_using_enum_value ()
22
22
{
23
23
$ model = new NativeCastModel ;
24
+ // @phpstan-ignore-next-line loose typing
24
25
$ model ->user_type = UserType::Moderator;
25
26
26
27
$ this ->assertEquals (UserType::Moderator (), $ model ->user_type );
27
28
}
28
29
29
30
public function test_cannot_set_model_value_using_invalid_enum_value ()
30
31
{
31
- $ this ->expectException (InvalidEnumMemberException::class);
32
-
33
32
$ model = new NativeCastModel ;
33
+
34
+ $ this ->expectException (InvalidEnumMemberException::class);
35
+ // @phpstan-ignore-next-line intentionally wrong
34
36
$ model ->user_type = 5 ;
35
37
}
36
38
37
39
public function test_getting_model_value_returns_enum_instance ()
38
40
{
39
41
$ model = new NativeCastModel ;
42
+ // @phpstan-ignore-next-line loose typing
40
43
$ model ->user_type = UserType::Moderator;
41
44
42
45
$ this ->assertInstanceOf (UserType::class, $ model ->user_type );
You can’t perform that action at this time.
0 commit comments