Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit 4b0a016

Browse files
author
Jens Schulze
committed
WIP: refactor traits with type safe abstract methods
1 parent 8aa3f67 commit 4b0a016

File tree

9 files changed

+52
-8
lines changed

9 files changed

+52
-8
lines changed

src/Core/Model/Common/LocaleTrait.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ public function setLocale($locale)
1616
return $this;
1717
}
1818

19+
/**
20+
* @return array
21+
*/
22+
abstract public function toArray();
23+
1924
/**
2025
* @return array
2126
*/

src/Core/Request/CustomerIdTrait.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010

1111
/**
1212
* @package Commercetools\Core\Request
13-
* @method $this addParamObject(ParameterInterface $param)
1413
*/
1514
trait CustomerIdTrait
1615
{
16+
/**
17+
* @param ParameterInterface $param
18+
* @return $this
19+
*/
20+
abstract public function addParamObject(ParameterInterface $param);
21+
1722
public function byCustomerId($customerId)
1823
{
1924
if (!is_null($customerId)) {

src/Core/Request/ExpandTrait.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010

1111
/**
1212
* @package Commercetools\Core\Request
13-
* @method $this addParamObject(ParameterInterface $param)
1413
*/
1514
trait ExpandTrait
1615
{
16+
/**
17+
* @param ParameterInterface $param
18+
* @return $this
19+
*/
20+
abstract public function addParamObject(ParameterInterface $param);
21+
1722
/**
1823
* @param $fieldReference
1924
* @return $this

src/Core/Request/PageTrait.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111

1212
/**
1313
* @package Commercetools\Core\Request
14-
* @method $this addParamObject(ParameterInterface $param)
1514
*/
1615
trait PageTrait
1716
{
17+
/**
18+
* @param ParameterInterface $param
19+
* @return $this
20+
*/
21+
abstract public function addParamObject(ParameterInterface $param);
22+
1823
/**
1924
* @param int $limit
2025
* @return $this

src/Core/Request/PriceSelectTrait.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
use Commercetools\Core\Request\Query\ParameterInterface;
1212

1313
/**
14-
* @method $this addParamObject(ParameterInterface $param)
1514
*/
1615
trait PriceSelectTrait
1716
{
17+
/**
18+
* @param ParameterInterface $param
19+
* @return $this
20+
*/
21+
abstract public function addParamObject(ParameterInterface $param);
1822

1923
protected function select($key, $value)
2024
{

src/Core/Request/QueryTrait.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111

1212
/**
1313
* @package Commercetools\Core\Request
14-
* @method $this addParamObject(ParameterInterface $param)
1514
*/
1615
trait QueryTrait
1716
{
17+
/**
18+
* @param ParameterInterface $param
19+
* @return $this
20+
*/
21+
abstract public function addParamObject(ParameterInterface $param);
22+
1823
/**
1924
* @param string $where
2025
* @return $this

src/Core/Request/SortTrait.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111

1212
/**
1313
* @package Commercetools\Core\Request
14-
* @method $this addParamObject(ParameterInterface $param)
1514
*/
1615
trait SortTrait
1716
{
17+
/**
18+
* @param ParameterInterface $param
19+
* @return $this
20+
*/
21+
abstract public function addParamObject(ParameterInterface $param);
22+
1823
/**
1924
* @param string $sort
2025
* @return $this

src/Core/Request/StagedTrait.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111

1212
/**
1313
* @package Commercetools\Core\Request
14-
* @method $this addParamObject(ParameterInterface $param)
1514
*/
1615
trait StagedTrait
1716
{
17+
/**
18+
* @param ParameterInterface $param
19+
* @return $this
20+
*/
21+
abstract public function addParamObject(ParameterInterface $param);
22+
1823
/**
1924
* @param bool $staged
2025
* @return $this

src/Core/Request/WithTotalTrait.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010

1111
/**
1212
* @package Commercetools\Core\Request
13-
* @method $this addParamObject(ParameterInterface $param)
1413
*/
1514
trait WithTotalTrait
1615
{
16+
/**
17+
* @param ParameterInterface $param
18+
* @return $this
19+
*/
20+
abstract public function addParamObject(ParameterInterface $param);
21+
1722
/**
1823
* @param bool $withTotal
1924
* @return $this

0 commit comments

Comments
 (0)