File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,26 +68,22 @@ public function toString(): string
6868 /**
6969 * {@inheritDoc}
7070 */
71- public function evaluate ($ other, string $ description = '' , bool $ returnResult = false )
71+ protected function matches ($ other): bool
7272 {
73- $ success = false ;
73+ $ valueExists = false ;
7474 if (is_array ($ other )) {
7575 $ other = array_values ($ other );
76- $ success = isset ($ other [$ this ->index ]);
76+ $ valueExists = isset ($ other [$ this ->index ]);
7777 } elseif ($ other instanceof Traversable) {
7878 $ other = iterator_to_array ($ other , false );
79- $ success = isset ($ other [$ this ->index ]);
79+ $ valueExists = isset ($ other [$ this ->index ]);
8080 }
8181
82- if (!$ success ) {
83- if ($ returnResult ) {
84- return false ;
85- }
86-
87- $ this ->fail ($ other , $ description );
82+ if (!$ valueExists ) {
83+ return false ;
8884 }
8985
90- return $ this ->constraint ->evaluate ($ other [$ this ->index ], $ description , $ returnResult );
86+ return $ this ->constraint ->evaluate ($ other [$ this ->index ], '' , true );
9187 }
9288
9389 /**
Original file line number Diff line number Diff line change @@ -64,24 +64,20 @@ public function toString(): string
6464 /**
6565 * {@inheritDoc}
6666 */
67- public function evaluate ($ other, string $ description = '' , bool $ returnResult = false )
67+ protected function matches ($ other): bool
6868 {
69- $ success = false ;
69+ $ valueExists = false ;
7070 if (is_array ($ other )) {
71- $ success = array_key_exists ($ this ->key , $ other );
71+ $ valueExists = array_key_exists ($ this ->key , $ other );
7272 } elseif ($ other instanceof ArrayAccess) {
73- $ success = $ other ->offsetExists ($ this ->key );
73+ $ valueExists = $ other ->offsetExists ($ this ->key );
7474 }
7575
76- if (!$ success ) {
77- if ($ returnResult ) {
78- return false ;
79- }
80-
81- $ this ->fail ($ other , $ description );
76+ if (!$ valueExists ) {
77+ return false ;
8278 }
8379
84- return $ this ->constraint ->evaluate ($ other [$ this ->key ], $ description , $ returnResult );
80+ return $ this ->constraint ->evaluate ($ other [$ this ->key ], '' , true );
8581 }
8682
8783 /**
You can’t perform that action at this time.
0 commit comments