File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,6 @@ class JsonValueMatchesMany extends Constraint
17
17
/** @var JsonValueMatches[] */
18
18
private $ constraints = array ();
19
19
20
- /** @var string[] */
21
- private $ failedConstraints = array ();
22
-
23
20
/**
24
21
* JsonValueMatchesMany constructor.
25
22
*
@@ -62,14 +59,12 @@ function (Constraint $constraint) {
62
59
*/
63
60
protected function matches ($ other ): bool
64
61
{
65
- $ result = true ;
66
62
foreach ($ this ->constraints as $ constraint ) {
67
63
if (!$ constraint ->evaluate ($ other , '' , true )) {
68
- $ result = false ;
69
- $ this ->failedConstraints [] = $ constraint ->toString ();
64
+ return false ;
70
65
}
71
66
}
72
- return $ result ;
67
+ return true ;
73
68
}
74
69
75
70
/**
@@ -79,6 +74,15 @@ protected function matches($other): bool
79
74
*/
80
75
protected function additionalFailureDescription ($ other ): string
81
76
{
82
- return "\n" . implode ("\n" , $ this ->failedConstraints );
77
+ /** @var string[] */
78
+ $ failedConstraints = array ();
79
+
80
+ foreach ($ this ->constraints as $ constraint ) {
81
+ if (!$ constraint ->evaluate ($ other , '' , true )) {
82
+ $ failedConstraints [] = $ constraint ->toString ();
83
+ }
84
+ }
85
+
86
+ return "\n" . implode ("\n" , $ failedConstraints );
83
87
}
84
88
}
You can’t perform that action at this time.
0 commit comments