12
12
use RuntimeException ;
13
13
use SebastianBergmann \Comparator \ComparisonFailure ;
14
14
use SebastianBergmann \Comparator \Factory ;
15
+ use SebastianBergmann \Exporter \Exporter ;
15
16
use stdClass ;
16
17
17
18
use function array_values ;
@@ -80,12 +81,12 @@ public function evaluate($other, string $description = '', bool $returnResult =
80
81
$ this ->assertEquals ($ this ->value , $ other , $ this ->ignoreExtraKeysInRoot );
81
82
$ success = true ;
82
83
} catch (RuntimeException $ e ) {
84
+ $ exporter = new Exporter ();
83
85
$ this ->lastFailure = new ComparisonFailure (
84
86
$ this ->value ,
85
87
$ other ,
86
- $ this ->exporter ()->export ($ this ->value ),
87
- $ this ->exporter ()->export ($ other ),
88
- false ,
88
+ $ exporter ->export ($ this ->value ),
89
+ $ exporter ->export ($ other ),
89
90
$ e ->getMessage (),
90
91
);
91
92
}
@@ -123,7 +124,7 @@ private function assertEquals(ArrayObject $expected, ArrayObject $actual, bool $
123
124
if ($ expected ::class !== $ actual ::class) {
124
125
throw new RuntimeException (sprintf (
125
126
'%s is not instance of expected class "%s" ' ,
126
- $ this -> exporter ( )->shortenedExport ($ actual ),
127
+ ( new Exporter () )->shortenedExport ($ actual ),
127
128
$ expected ::class,
128
129
));
129
130
}
@@ -162,11 +163,10 @@ private function assertEquals(ArrayObject $expected, ArrayObject $actual, bool $
162
163
$ actualValue ,
163
164
'' ,
164
165
'' ,
165
- false ,
166
166
sprintf (
167
167
'Field path "%s": %s is not instance of expected type "%s". ' ,
168
168
$ keyPrefix . $ key ,
169
- $ this -> exporter ( )->shortenedExport ($ actualValue ),
169
+ ( new Exporter () )->shortenedExport ($ actualValue ),
170
170
$ expectedType ,
171
171
),
172
172
);
@@ -180,7 +180,6 @@ private function assertEquals(ArrayObject $expected, ArrayObject $actual, bool $
180
180
$ actualValue ,
181
181
'' ,
182
182
'' ,
183
- false ,
184
183
sprintf ('Field path "%s": %s ' , $ keyPrefix . $ key , $ failure ->getMessage ()),
185
184
);
186
185
}
@@ -233,7 +232,7 @@ protected function matches($other): bool
233
232
234
233
public function toString (): string
235
234
{
236
- return 'matches ' . $ this -> exporter ( )->export ($ this ->value );
235
+ return 'matches ' . ( new Exporter () )->export ($ this ->value );
237
236
}
238
237
239
238
private static function isNumeric ($ value ): bool
0 commit comments