Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Commit

Permalink
Php 7.2 support: Cast to array when counting
Browse files Browse the repository at this point in the history
Fixes #5
  • Loading branch information
daniel-de-wit committed Nov 1, 2018
1 parent 32dc984 commit 22b3d72
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Encoder/Transformers/ModelTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public function transform($model)
Key::META => $this->serializeMetaData($resource),
];

if ( ! count($data[ Key::ATTRIBUTES ])) {
if ( ! count((array) $data[ Key::ATTRIBUTES ])) {
unset($data[ Key::ATTRIBUTES ]);
}

if ( ! count($data[ Key::RELATIONSHIPS ])) {
if ( ! count((array) $data[ Key::RELATIONSHIPS ])) {
unset($data[ Key::RELATIONSHIPS ]);
}

if ( ! count($data[ Key::META ])) {
if ( ! count((array) $data[ Key::META ])) {
unset($data[ Key::META ]);
}

Expand Down

0 comments on commit 22b3d72

Please sign in to comment.