From 906ee6461b1f40ae09873f7743f4c62a7a23c048 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 26 Jun 2021 14:38:08 +0200 Subject: [PATCH] fix phpstan/phpcs --- Models/ItemAttributeType.php | 12 +++++------- Models/ItemAttributeTypeL11n.php | 4 +--- Models/ItemAttributeValue.php | 7 +++++++ composer.json | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Models/ItemAttributeType.php b/Models/ItemAttributeType.php index d9399c9..8cf381f 100755 --- a/Models/ItemAttributeType.php +++ b/Models/ItemAttributeType.php @@ -68,9 +68,7 @@ class ItemAttributeType implements \JsonSerializable, ArrayableInterface * * @var ItemAttributeTypeL11n */ - protected string | - - ItemAttributeTypeL11n $l11n; + protected string|ItemAttributeTypeL11n $l11n; /** * Possible default attribute values @@ -113,16 +111,16 @@ class ItemAttributeType implements \JsonSerializable, ArrayableInterface * * @since 1.0.0 */ - public function setL11n($l11n, string $lang = ISO639x1Enum::_EN) : void + public function setL11n(string|ItemAttributeTypeL11n $l11n, string $lang = ISO639x1Enum::_EN) : void { if ($l11n instanceof ItemAttributeTypeL11n) { $this->l11n = $l11n; - } elseif (\is_string($l11n)) { + } elseif ($this->l11n instanceof ItemAttributeTypeL11n) { + $this->l11n->title = $l11n; + } else { $this->l11n = new ItemAttributeTypeL11n(); $this->l11n->title = $l11n; $this->l11n->setLanguage($lang); - } elseif ($this->l11n instanceof ItemAttributeTypeL11n && \is_string($l11n)) { - $this->l11n->title = $l11n; } } diff --git a/Models/ItemAttributeTypeL11n.php b/Models/ItemAttributeTypeL11n.php index 655a60b..f1ec5f7 100755 --- a/Models/ItemAttributeTypeL11n.php +++ b/Models/ItemAttributeTypeL11n.php @@ -41,9 +41,7 @@ class ItemAttributeTypeL11n implements \JsonSerializable, ArrayableInterface * @var int|ItemAttributeType * @since 1.0.0 */ - protected int | - -ItemAttributeType $type = 0; + protected int|ItemAttributeType $type = 0; /** * Language. diff --git a/Models/ItemAttributeValue.php b/Models/ItemAttributeValue.php index ffb4520..e27af22 100755 --- a/Models/ItemAttributeValue.php +++ b/Models/ItemAttributeValue.php @@ -153,6 +153,13 @@ class ItemAttributeValue implements \JsonSerializable, ArrayableInterface } } + /** + * Get value + * + * @return null|int|string|float|\DateTimeInterface + * + * @since 1.0.0 + */ public function getValue() : mixed { if (!empty($this->valueStr)) { diff --git a/composer.json b/composer.json index be46f49..0bf301c 100755 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ ], "require-dev": { "phpunit/phpunit": ">=9.4", - "friendsofphp/php-cs-fixer": ">=2.18", + "friendsofphp/php-cs-fixer": ">=3.0", "squizlabs/php_codesniffer": ">=3.5", "phpmd/phpmd": ">=2.9", "phpstan/phpstan": ">=0.12.58",