@@ -186,7 +186,8 @@ protected function doFind(bool $singleton, $id = null)
186
186
{
187
187
$ builder = $ this ->builder ();
188
188
189
- if ($ this ->useCasts ()) {
189
+ $ useCast = $ this ->useCasts ();
190
+ if ($ useCast ) {
190
191
$ returnType = $ this ->tempReturnType ;
191
192
$ this ->asArray ();
192
193
}
@@ -207,7 +208,7 @@ protected function doFind(bool $singleton, $id = null)
207
208
$ row = $ builder ->get ()->getResult ($ this ->tempReturnType );
208
209
}
209
210
210
- if ($ this -> useCasts () ) {
211
+ if ($ useCast ) {
211
212
$ row = $ this ->convertToReturnType ($ row , $ returnType );
212
213
213
214
$ this ->tempReturnType = $ returnType ;
@@ -257,7 +258,8 @@ protected function doFindAll(?int $limit = null, int $offset = 0)
257
258
258
259
$ builder = $ this ->builder ();
259
260
260
- if ($ this ->useCasts ()) {
261
+ $ useCast = $ this ->useCasts ();
262
+ if ($ useCast ) {
261
263
$ returnType = $ this ->tempReturnType ;
262
264
$ this ->asArray ();
263
265
}
@@ -270,7 +272,7 @@ protected function doFindAll(?int $limit = null, int $offset = 0)
270
272
->get ()
271
273
->getResult ($ this ->tempReturnType );
272
274
273
- if ($ this -> useCasts () ) {
275
+ if ($ useCast ) {
274
276
foreach ($ results as $ i => $ row ) {
275
277
$ results [$ i ] = $ this ->convertToReturnType ($ row , $ returnType );
276
278
}
@@ -293,7 +295,8 @@ protected function doFirst()
293
295
{
294
296
$ builder = $ this ->builder ();
295
297
296
- if ($ this ->useCasts ()) {
298
+ $ useCast = $ this ->useCasts ();
299
+ if ($ useCast ) {
297
300
$ returnType = $ this ->tempReturnType ;
298
301
$ this ->asArray ();
299
302
}
@@ -312,7 +315,7 @@ protected function doFirst()
312
315
313
316
$ row = $ builder ->limit (1 , 0 )->get ()->getFirstRow ($ this ->tempReturnType );
314
317
315
- if ($ this -> useCasts () ) {
318
+ if ($ useCast ) {
316
319
$ row = $ this ->convertToReturnType ($ row , $ returnType );
317
320
318
321
$ this ->tempReturnType = $ returnType ;
0 commit comments