Skip to content

Commit

Permalink
feature - MAR-12777 - all vars and func promotions marked as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
radekbednar authored and Martin Krutak committed Oct 3, 2022
1 parent 3891b86 commit 3689c45
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 4.4.0 - 2022-10-03

### Changed

- `promotions` attribute is deprecated

## 4.3.0 - 2022-10-03

### Added
Expand Down
16 changes: 16 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,20 @@
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<issueHandlers>
<DeprecatedClass>
<errorLevel type="suppress">
<file name="src/Article/Entity/Common/PromotionIterator.php"/>
<file name="src/Article/Entity/Common/AbstractArticle.php"/>
<file name="src/Article/DTO/AbstractArticleRequest.php"/>
</errorLevel>
</DeprecatedClass>
<DeprecatedProperty>
<errorLevel type="suppress">
<file name="src/Article/Entity/Common/AbstractArticle.php"/>
<file name="src/Article/DTO/AbstractArticleRequest.php"/>
</errorLevel>
</DeprecatedProperty>
</issueHandlers>
</psalm>
7 changes: 7 additions & 0 deletions src/Article/DTO/AbstractArticleRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ abstract class AbstractArticleRequest implements JsonSerializable
protected ?float $purchasePrice = null;
protected ?float $rrp = null;
protected MediaIterator $media;
/** @deprecated */
protected PromotionIterator $promotions;
protected ParameterIterator $parameters;
protected LabelIterator $labels;
Expand Down Expand Up @@ -146,11 +147,17 @@ public function setMedia(MediaIterator $media): void
$this->media = $media;
}

/**
* @deprecated
*/
public function getPromotions(): PromotionIterator
{
return $this->promotions;
}

/**
* @deprecated
*/
public function setPromotions(PromotionIterator $promotions): void
{
$this->promotions = $promotions;
Expand Down
2 changes: 2 additions & 0 deletions src/Article/DTO/ProductRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public static function createFromProduct(Product $product): self
$self->setPurchasePrice($product->getPurchasePrice());
$self->setRrp($product->getRrp());
$self->setMedia($product->getMedia());
/** @psalm-suppress DeprecatedMethod */
$self->setPromotions($product->getPromotions());
$self->setParameters($product->getParameters());
$self->setDimensions($product->getDimensions());
Expand Down Expand Up @@ -78,6 +79,7 @@ public static function createFromProduct(Product $product): self
*/
public function getArrayForApi(): array
{
/** @psalm-suppress DeprecatedMethod */
$mandatory = [
'id' => $this->getId(),
'title' => $this->getTitle(),
Expand Down
2 changes: 2 additions & 0 deletions src/Article/DTO/VariantRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static function createFromVariant(Variant $variant): self
$self->setBarcode($variant->getBarcode());
$self->setPurchasePrice($variant->getPurchasePrice());
$self->setRrp($variant->getRrp());
/** @psalm-suppress DeprecatedMethod */
$self->setPromotions($variant->getPromotions());
$self->setDimensions($variant->getDimensions());
$self->setAvailability($variant->getAvailability());
Expand All @@ -61,6 +62,7 @@ public static function createFromVariant(Variant $variant): self
*/
public function getArrayForApi(): array
{
/** @psalm-suppress DeprecatedMethod */
$mandatory = [
'id' => $this->getId(),
'title' => $this->getTitle(),
Expand Down
6 changes: 6 additions & 0 deletions src/Article/Entity/Common/AbstractArticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ abstract class AbstractArticle implements JsonSerializable
protected float $purchasePrice;
protected float $rrp;
protected MediaIterator $media;
/**
* @deprecated
*/
protected PromotionIterator $promotions;
protected ParameterIterator $parameters;
protected Dimensions $dimensions;
Expand Down Expand Up @@ -188,6 +191,9 @@ public function getMedia(): MediaIterator
return $this->media;
}

/**
* @deprecated
*/
public function getPromotions(): PromotionIterator
{
return $this->promotions;
Expand Down
1 change: 1 addition & 0 deletions src/Article/Entity/Common/Promotion.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use MpApiClient\Common\Util\InputDataUtil;
use MpApiClient\Common\Util\JsonSerializeEntityTrait;

/** @deprecated */
final class Promotion implements JsonSerializable
{

Expand Down
1 change: 1 addition & 0 deletions src/Article/Entity/Common/PromotionIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/**
* @extends AbstractIntKeyIterator<Promotion>
* @property Promotion[] $data
* @deprecated
*/
final class PromotionIterator extends AbstractIntKeyIterator
{
Expand Down
2 changes: 2 additions & 0 deletions src/Article/Entity/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ final class Product extends AbstractArticle
protected ?float $weeeFee;

/**
* @psalm-suppress DeprecatedClass
* @param string $id
* @param int $articleId
* @param ProductStageEnum $stage
Expand Down Expand Up @@ -141,6 +142,7 @@ private function __construct(
*/
public static function createFromApi(array $data): self
{
/** @psalm-suppress DeprecatedClass */
return new self(
(string) $data['id'],
(int) $data['article_id'],
Expand Down
1 change: 1 addition & 0 deletions src/Article/Entity/Variant.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ final class Variant extends AbstractArticle
*/
public static function createFromApi(array $data): self
{
/** @psalm-suppress DeprecatedClass */
return new self(
(string) $data['id'],
(int) $data['article_id'],
Expand Down
2 changes: 1 addition & 1 deletion src/MpApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class MpApiClient implements ClientInterface, MpApiClientInterface
{

const APP_NAME = 'mp-api-client';
const APP_VERSION = '4.2.0';
const APP_VERSION = '4.4.0';

private BrandClientInterface $brandClient;
private CategoryClientInterface $categoryClient;
Expand Down

0 comments on commit 3689c45

Please sign in to comment.