@@ -85,12 +85,12 @@ private function describeVar($var, int $depth = 0, int $refId = null)
8585 private function describeDouble (float $ num )
8686 {
8787 if (!is_finite ($ num )) {
88- return new Value (' number ' , (string ) $ num );
88+ return new Value (Value:: TYPE_NUMBER , (string ) $ num );
8989 }
9090 $ js = json_encode ($ num );
9191 return strpos ($ js , '. ' )
9292 ? $ num
93- : new Value (' number ' , "$ js.0 " ); // to distinct int and float in JS
93+ : new Value (Value:: TYPE_NUMBER , "$ js.0 " ); // to distinct int and float in JS
9494 }
9595
9696
@@ -103,9 +103,9 @@ private function describeString(string $s)
103103 if ($ res === $ s ) {
104104 return $ res ;
105105 } elseif ($ utf ) { // is UTF-8
106- return new Value (' string ' , $ res , strlen (utf8_decode ($ s )));
106+ return new Value (Value:: TYPE_STRING , $ res , strlen (utf8_decode ($ s )));
107107 } else {
108- return new Value (' bin ' , $ res , strlen ($ s ));
108+ return new Value (Value:: TYPE_BINARY , $ res , strlen ($ s ));
109109 }
110110 }
111111
@@ -117,7 +117,7 @@ private function describeArray(array $arr, int $depth = 0, int $refId = null)
117117 {
118118 if ($ refId || count ($ arr ) > $ this ->maxItems ) {
119119 $ id = $ refId ? 'a ' . $ refId : 'A ' . count ($ this ->snapshot );
120- $ res = new Value (' array ' , $ id );
120+ $ res = new Value (Value:: TYPE_ARRAY , $ id );
121121
122122 $ shot = &$ this ->snapshot [$ id ];
123123 if (!$ shot ) {
@@ -138,7 +138,7 @@ private function describeArray(array $arr, int $depth = 0, int $refId = null)
138138 $ items = &$ shot ->items ;
139139
140140 } elseif ($ arr && $ depth >= $ this ->maxDepth ) {
141- return new Value (' stop ' , count ($ arr ));
141+ return new Value (Value:: TYPE_STOP , count ($ arr ));
142142 }
143143
144144 $ items = [];
@@ -147,7 +147,7 @@ private function describeArray(array $arr, int $depth = 0, int $refId = null)
147147 $ items [] = [
148148 $ this ->describeVar ($ k , $ depth + 1 ),
149149 is_string ($ k ) && isset ($ this ->keysToHide [strtolower ($ k )])
150- ? new Value (' text ' , self ::hideValue ($ v ))
150+ ? new Value (Value:: TYPE_TEXT , self ::hideValue ($ v ))
151151 : $ this ->describeVar ($ v , $ depth + 1 , $ refId ),
152152 ] + ($ refId ? [2 => $ refId ] : []);
153153 }
@@ -172,7 +172,7 @@ private function describeObject(object $obj, int $depth = 0): Value
172172 $ shot ->editor = (object ) ['file ' => $ rc ->getFileName (), 'line ' => $ rc ->getStartLine (), 'url ' => $ editor ];
173173 }
174174 } elseif ($ shot ->depth <= $ depth ) {
175- return new Value (' object ' , $ id );
175+ return new Value (Value:: TYPE_OBJECT , $ id );
176176 }
177177
178178 if ($ depth < $ this ->maxDepth ) {
@@ -190,12 +190,12 @@ private function describeObject(object $obj, int $depth = 0): Value
190190 $ refId = $ this ->getReferenceId ($ info , 1 );
191191 $ k = (string ) $ k ;
192192 $ v = isset ($ this ->keysToHide [strtolower ($ k )])
193- ? new Value (' text ' , self ::hideValue ($ v ))
193+ ? new Value (Value:: TYPE_TEXT , self ::hideValue ($ v ))
194194 : $ this ->describeVar ($ v , $ depth + 1 , $ refId );
195195 $ shot ->items [] = [$ this ->encodeKey ($ k ), $ v , $ type ] + ($ refId ? [3 => $ refId ] : []);
196196 }
197197 }
198- return new Value (' object ' , $ id );
198+ return new Value (Value:: TYPE_OBJECT , $ id );
199199 }
200200
201201
@@ -216,7 +216,7 @@ private function describeResource($resource, int $depth = 0): Value
216216 }
217217 }
218218 }
219- return new Value (' resource ' , $ id );
219+ return new Value (Value:: TYPE_RESOURCE , $ id );
220220 }
221221
222222
0 commit comments