Skip to content

Commit

Permalink
Merge pull request #288 from bburnichon/improvement/typehinting
Browse files Browse the repository at this point in the history
Fixup some type hintings related to Resource
  • Loading branch information
philsturgeon committed May 16, 2016
2 parents 1a78f76 + 5ae5907 commit d2be7f6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
24 changes: 13 additions & 11 deletions src/Resource/ResourceAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace League\Fractal\Resource;

use League\Fractal\TransformerAbstract;

abstract class ResourceAbstract implements ResourceInterface
{
/**
Expand All @@ -37,18 +39,16 @@ abstract class ResourceAbstract implements ResourceInterface
/**
* A callable to process the data attached to this resource.
*
* @var callable|string
* @var callable|TransformerAbstract|null
*/
protected $transformer;

/**
* Create a new resource instance.
*
* @param mixed $data
* @param callable|string $transformer
* @param string $resourceKey
*
* @return void
* @param mixed $data
* @param callable|TransformerAbstract|null $transformer
* @param string $resourceKey
*/
public function __construct($data = null, $transformer = null, $resourceKey = null)
{
Expand All @@ -71,7 +71,8 @@ public function getData()
* Set the data.
*
* @param mixed $data
* @return \League\Fractal\Resource\ResourceAbstract
*
* @return $this
*/
public function setData($data)
{
Expand Down Expand Up @@ -115,7 +116,7 @@ public function getResourceKey()
/**
* Get the transformer.
*
* @return callable|string
* @return callable|TransformerAbstract
*/
public function getTransformer()
{
Expand All @@ -125,8 +126,9 @@ public function getTransformer()
/**
* Set the transformer.
*
* @param callable|string $transformer
* @return \League\Fractal\Resource\ResourceAbstract
* @param callable|TransformerAbstract $transformer
*
* @return $this
*/
public function setTransformer($transformer)
{
Expand Down Expand Up @@ -169,7 +171,7 @@ public function setMetaValue($metaKey, $metaValue)
*
* @param string $resourceKey
*
* @return \League\Fractal\Resource\ResourceAbstract
* @return $this
*/
public function setResourceKey($resourceKey)
{
Expand Down
10 changes: 6 additions & 4 deletions src/Resource/ResourceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,25 @@ public function getData();
/**
* Get the transformer.
*
* @return callable|string
* @return callable|\League\Fractal\TransformerAbstract
*/
public function getTransformer();

/**
* Set the data.
*
* @param mixed $data
* @return \League\Fractal\Resource\ResourceAbstract
*
* @return $this
*/
public function setData($data);

/**
* Set the transformer.
*
* @param callable|string $transformer
* @return \League\Fractal\Resource\ResourceAbstract
* @param callable|\League\Fractal\TransformerAbstract $transformer
*
* @return $this
*/
public function setTransformer($transformer);
}

0 comments on commit d2be7f6

Please sign in to comment.