diff --git a/Controller/ApiController.php b/Controller/ApiController.php index a4356b5..00699e3 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -201,10 +201,10 @@ final class ApiController extends Controller */ private function createSupplierAttributeFromRequest(RequestAbstract $request) : SupplierAttribute { - $attribute = new SupplierAttribute(); - $attribute->supplier = (int) $request->getData('supplier'); - $attribute->type = new NullSupplierAttributeType((int) $request->getData('type')); - $attribute->value = new NullSupplierAttributeValue((int) $request->getData('value')); + $attribute = new SupplierAttribute(); + $attribute->supplier = (int) $request->getData('supplier'); + $attribute->type = new NullSupplierAttributeType((int) $request->getData('type')); + $attribute->value = new NullSupplierAttributeValue((int) $request->getData('value')); return $attribute; } diff --git a/Models/SupplierAttributeType.php b/Models/SupplierAttributeType.php index 5294f27..b116a67 100755 --- a/Models/SupplierAttributeType.php +++ b/Models/SupplierAttributeType.php @@ -68,9 +68,7 @@ class SupplierAttributeType implements \JsonSerializable, ArrayableInterface * * @var string | SupplierAttributeTypeL11n */ - protected string | - - SupplierAttributeTypeL11n $l11n; + protected string|SupplierAttributeTypeL11n $l11n; /** * Possible default attribute values @@ -113,16 +111,16 @@ class SupplierAttributeType implements \JsonSerializable, ArrayableInterface * * @since 1.0.0 */ - public function setL11n($l11n, string $lang = ISO639x1Enum::_EN) : void + public function setL11n(string|SupplierAttributeTypeL11n $l11n, string $lang = ISO639x1Enum::_EN) : void { if ($l11n instanceof SupplierAttributeTypeL11n) { $this->l11n = $l11n; - } elseif (\is_string($l11n)) { + } elseif ($this->l11n instanceof SupplierAttributeTypeL11n) { + $this->l11n->title = $l11n; + } else { $this->l11n = new SupplierAttributeTypeL11n(); $this->l11n->title = $l11n; $this->l11n->setLanguage($lang); - } elseif ($this->l11n instanceof SupplierAttributeTypeL11n && \is_string($l11n)) { - $this->l11n->title = $l11n; } } diff --git a/Models/SupplierAttributeTypeL11n.php b/Models/SupplierAttributeTypeL11n.php index e5cdd98..117f4ca 100755 --- a/Models/SupplierAttributeTypeL11n.php +++ b/Models/SupplierAttributeTypeL11n.php @@ -41,9 +41,7 @@ class SupplierAttributeTypeL11n implements \JsonSerializable, ArrayableInterface * @var int|SupplierAttributeType * @since 1.0.0 */ - protected int | - -SupplierAttributeType $type = 0; + protected int|SupplierAttributeType $type = 0; /** * Language. diff --git a/Models/SupplierAttributeValue.php b/Models/SupplierAttributeValue.php index d8f09db..a43332a 100755 --- a/Models/SupplierAttributeValue.php +++ b/Models/SupplierAttributeValue.php @@ -153,6 +153,13 @@ class SupplierAttributeValue 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",