File tree Expand file tree Collapse file tree 7 files changed +39
-6
lines changed Expand file tree Collapse file tree 7 files changed +39
-6
lines changed Original file line number Diff line number Diff line change 66
77use Swis \JsonApi \Client \Interfaces \ItemInterface ;
88
9+ /**
10+ * @template TItem of \Swis\JsonApi\Client\Interfaces\ItemInterface
11+ */
912trait Create
1013{
1114 /**
12- * @return \Swis\JsonApi\Client\Interfaces\DocumentInterface
15+ * @return \Swis\JsonApi\Client\Interfaces\ItemDocumentInterface<TItem>
1316 */
1417 public function create (ItemInterface $ item , array $ parameters = [], array $ headers = [])
1518 {
Original file line number Diff line number Diff line change 44
55namespace Swis \JsonApi \Client \Actions ;
66
7+ /**
8+ * @template TItem of \Swis\JsonApi\Client\Interfaces\ItemInterface
9+ */
710trait FetchMany
811{
912 /**
10- * @return \Swis\JsonApi\Client\Interfaces\DocumentInterface
13+ * @return \Swis\JsonApi\Client\Interfaces\CollectionDocumentInterface<TItem>
1114 */
1215 public function all (array $ parameters = [], array $ headers = [])
1316 {
Original file line number Diff line number Diff line change 44
55namespace Swis \JsonApi \Client \Actions ;
66
7+ /**
8+ * @template TItem of \Swis\JsonApi\Client\Interfaces\ItemInterface
9+ */
710trait FetchOne
811{
912 /**
10- * @return \Swis\JsonApi\Client\Interfaces\DocumentInterface
13+ * @return \Swis\JsonApi\Client\Interfaces\ItemDocumentInterface<TItem>
1114 */
1215 public function find (string $ id , array $ parameters = [], array $ headers = [])
1316 {
Original file line number Diff line number Diff line change 66
77use Swis \JsonApi \Client \Interfaces \ItemInterface ;
88
9+ /**
10+ * @template TItem of \Swis\JsonApi\Client\Interfaces\ItemInterface
11+ */
912trait Save
1013{
14+ /** @use Create<TItem> */
1115 use Create { create as protected saveNew; }
16+
17+ /** @use Update<TItem> */
1218 use Update { update as protected saveExisting; }
1319
1420 /**
15- * @return \Swis\JsonApi\Client\Interfaces\DocumentInterface
21+ * @return \Swis\JsonApi\Client\Interfaces\ItemDocumentInterface<TItem>
1622 */
1723 public function save (ItemInterface $ item , array $ parameters = [], array $ headers = [])
1824 {
Original file line number Diff line number Diff line change 44
55namespace Swis \JsonApi \Client \Actions ;
66
7+ /**
8+ * @template TItem of \Swis\JsonApi\Client\Interfaces\ItemInterface
9+ */
710trait TakeOne
811{
912 /**
10- * @return \Swis\JsonApi\Client\Interfaces\DocumentInterface
13+ * @return \Swis\JsonApi\Client\Interfaces\ItemDocumentInterface<TItem>
1114 */
1215 public function take (array $ parameters = [], array $ headers = [])
1316 {
Original file line number Diff line number Diff line change 66
77use Swis \JsonApi \Client \Interfaces \ItemInterface ;
88
9+ /**
10+ * @template TItem of \Swis\JsonApi\Client\Interfaces\ItemInterface
11+ */
912trait Update
1013{
1114 /**
12- * @return \Swis\JsonApi\Client\Interfaces\DocumentInterface
15+ * @return \Swis\JsonApi\Client\Interfaces\ItemDocumentInterface<TItem>
1316 */
1417 public function update (ItemInterface $ item , array $ parameters = [], array $ headers = [])
1518 {
Original file line number Diff line number Diff line change 1111use Swis \JsonApi \Client \Actions \TakeOne ;
1212use Swis \JsonApi \Client \Interfaces \RepositoryInterface ;
1313
14+ /**
15+ * @template TItem of \Swis\JsonApi\Client\Interfaces\ItemInterface
16+ * @implements RepositoryInterface<TItem>
17+ */
1418class Repository extends BaseRepository implements RepositoryInterface
1519{
1620 use Delete;
21+
22+ /** @use FetchMany<TItem> */
1723 use FetchMany;
24+
25+ /** @use FetchOne<TItem> */
1826 use FetchOne;
27+
28+ /** @use Save<TItem> */
1929 use Save;
30+
31+ /** @use TakeOne<TItem> */
2032 use TakeOne;
2133}
You can’t perform that action at this time.
0 commit comments