22
33namespace Cristal \ApiWrapper ;
44
5- use ArrayAccess ;
65use Closure ;
6+ use Exception ;
7+ use ArrayAccess ;
8+ use JsonSerializable ;
79use Cristal \ApiWrapper \Concerns \HasAttributes ;
8- use Cristal \ApiWrapper \Concerns \ HasRelationships ;
10+ use Cristal \ApiWrapper \Exceptions \ ApiException ;
911use Cristal \ApiWrapper \Concerns \HasGlobalScopes ;
1012use Cristal \ApiWrapper \Concerns \HidesAttributes ;
11- use Cristal \ApiWrapper \Exceptions \ ApiException ;
13+ use Cristal \ApiWrapper \Concerns \ HasRelationships ;
1214use Cristal \ApiWrapper \Exceptions \MissingApiException ;
13- use Exception ;
14- use JsonSerializable ;
1515
1616abstract class Model implements ArrayAccess, JsonSerializable, \Stringable
1717{
@@ -182,7 +182,8 @@ public function fill(array $attributes = [])
182182 // start_measure('fill-model', 'Création de l\'objet '.static::class);
183183 foreach ($ attributes as $ key => $ value ) {
184184 if (is_array ($ value ) && method_exists ($ this , $ key )) {
185- $ this ->setRelation ($ key ,
185+ $ this ->setRelation (
186+ $ key ,
186187 $ this ->$ key ()->getRelationsFromArray ($ value )
187188 );
188189 } else {
@@ -316,7 +317,7 @@ public function toArray()
316317 *
317318 * @return array
318319 */
319- public function jsonSerialize ()
320+ public function jsonSerialize (): mixed
320321 {
321322 return $ this ->toArray ();
322323 }
@@ -328,7 +329,7 @@ public function jsonSerialize()
328329 *
329330 * @return bool
330331 */
331- public function offsetExists ($ offset )
332+ public function offsetExists ($ offset ): bool
332333 {
333334 return !is_null ($ this ->getAttribute ($ offset ));
334335 }
@@ -340,7 +341,7 @@ public function offsetExists($offset)
340341 *
341342 * @return mixed
342343 */
343- public function offsetGet ($ offset )
344+ public function offsetGet ($ offset ): mixed
344345 {
345346 return $ this ->getAttribute ($ offset );
346347 }
@@ -353,7 +354,7 @@ public function offsetGet($offset)
353354 *
354355 * @return void
355356 */
356- public function offsetSet ($ offset , $ value )
357+ public function offsetSet ($ offset , $ value ): void
357358 {
358359 $ this ->setAttribute ($ offset , $ value );
359360 }
@@ -365,7 +366,7 @@ public function offsetSet($offset, $value)
365366 *
366367 * @return void
367368 */
368- public function offsetUnset ($ offset )
369+ public function offsetUnset ($ offset ): void
369370 {
370371 unset($ this ->attributes [$ offset ]);
371372 }
0 commit comments