You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable validating private properties of parent classes
All validators related to object properties only consider the properties
of the object being validated, not those of its parent object. That's
because PHP reflection only gets the properties visible to the current
class (public or protected). The problem with that is that when there's
a private property in the parent class, we're completely unaware of it.
This commit will modify those rules by retrieving properties from the
parent class, ensuring we capture all properties that require
validation.
->and($message)->toBe('`.name` must not be empty')
48
48
->and($fullMessage)->toBe(<<<'FULL_MESSAGE'
49
-
- `Respect\Validation\Test\Stubs\WithAttributes { +$name="" +$birthdate="not a date" +$email="not an email" +$phone ... }` must pass the rules
49
+
- `Respect\Validation\Test\Stubs\WithAttributes { +$name="" +$birthdate="not a date" #$phone="not a phone number" + ... }` must pass the rules
50
50
- `.name` must not be empty
51
51
- `.birthdate` must pass all the rules
52
52
- `.birthdate` must be a valid date in the format "2005-12-30"
53
53
- For comparison with now, `.birthdate` must be a valid datetime
54
-
- `.email` must be a valid email address or must be null
55
54
- `.phone` must be a valid telephone number or must be null
55
+
- `.email` must be a valid email address or must be null
56
56
FULL_MESSAGE)
57
57
->and($messages)->toBe([
58
-
'__root__' => '`Respect\Validation\Test\Stubs\WithAttributes { +$name="" +$birthdate="not a date" +$email="not an email" +$phone ... }` must pass the rules',
58
+
'__root__' => '`Respect\Validation\Test\Stubs\WithAttributes { +$name="" +$birthdate="not a date" #$phone="not a phone number" + ... }` must pass the rules',
59
59
'name' => '`.name` must not be empty',
60
60
'birthdate' => 'For comparison with now, `.birthdate` must be a valid datetime',
61
-
'email' => '`.email` must be a valid email address or must be null',
62
61
'phone' => '`.phone` must be a valid telephone number or must be null',
62
+
'email' => '`.email` must be a valid email address or must be null',
- `Respect\Validation\Test\Stubs\WithAttributes { +$name="John Doe" +$birthdate="2024-06-23" +$email=null +$phone=n ... }` must pass at least one of the rules
71
+
- `Respect\Validation\Test\Stubs\WithAttributes { +$name="John Doe" +$birthdate="2024-06-23" #$phone=null +$address ... }` must pass at least one of the rules
72
72
- `.email` must be defined
73
73
- `.phone` must be defined
74
74
FULL_MESSAGE)
75
75
->and($messages)->toBe([
76
76
'anyOf' => [
77
-
'__root__' => '`Respect\Validation\Test\Stubs\WithAttributes { +$name="John Doe" +$birthdate="2024-06-23" +$email=null +$phone=n ... }` must pass at least one of the rules',
77
+
'__root__' => '`Respect\Validation\Test\Stubs\WithAttributes { +$name="John Doe" +$birthdate="2024-06-23" #$phone=null +$address ... }` must pass at least one of the rules',
0 commit comments