diff --git a/src/Manager.php b/src/Manager.php index 3b489612..32d03c7c 100644 --- a/src/Manager.php +++ b/src/Manager.php @@ -98,15 +98,11 @@ public function createData(ResourceInterface $resource, $scopeIdentifier = null, * * @param string $include * - * @return \League\Fractal\ParamBag|null + * @return \League\Fractal\ParamBag */ public function getIncludeParams($include) { - if (! isset($this->includeParams[$include])) { - return; - } - - $params = $this->includeParams[$include]; + $params = isset($this->includeParams[$include]) ? $this->includeParams[$include] : []; return new ParamBag($params); } diff --git a/src/TransformerAbstract.php b/src/TransformerAbstract.php index 2122aff8..cd0e9902 100644 --- a/src/TransformerAbstract.php +++ b/src/TransformerAbstract.php @@ -14,7 +14,7 @@ use League\Fractal\Resource\Collection; use League\Fractal\Resource\Item; use League\Fractal\Resource\NullResource; -use League\Fractal\Resource\ResourceAbstract; +use League\Fractal\Resource\ResourceInterface; /** * Transformer Abstract @@ -188,13 +188,13 @@ protected function callIncludeMethod(Scope $scope, $includeName, $data) return false; } - if (! $resource instanceof ResourceAbstract) { + if (! $resource instanceof ResourceInterface) { throw new \Exception(sprintf( 'Invalid return value from %s::%s(). Expected %s, received %s.', __CLASS__, $methodName, - 'League\Fractal\Resource\ResourceAbstract', - gettype($resource) + 'League\Fractal\Resource\ResourceInterface', + is_object($resource) ? get_class($resource) : gettype($resource) )); }