diff --git a/Model/Source/DefaultOptions.php b/Model/Source/DefaultOptions.php index b2982f20..2976d370 100755 --- a/Model/Source/DefaultOptions.php +++ b/Model/Source/DefaultOptions.php @@ -19,6 +19,9 @@ class DefaultOptions { + // Maximum characters length of company name. + const COMPANY_NAME_MAX_LENGTH = 50; + /** * @var Data */ @@ -79,19 +82,19 @@ public function getDefault($option) } /** - * @param $address + * @param string|null $address * - * @return string + * @return string|null */ - public function getMaxCompanyName(string $address): string + public function getMaxCompanyName(?string $address): ?string { - if (strlen($address) >= self::COMPANY_NAME_MAX_LENGTH) { + if (strlen((string) $address) >= self::COMPANY_NAME_MAX_LENGTH) { $address = substr($address, 0, 47) . '...'; } return $address; } - + /** * Get default value of insurance based on order grand total * @@ -158,7 +161,7 @@ private function isDigitalStampOrMailbox($option) { ) { return true; } - + return false; } } diff --git a/composer.json b/composer.json index cdef1a0f..8bdfe2db 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "myparcelnl/magento", "description": "A Magento 2 module that creates MyParcel labels", "type": "magento2-module", - "version": "2.5.6", + "version": "2.5.8", "homepage": "https://www.myparcel.nl", "keywords": ["MyParcel", "My Parcel", "Post NL", "PostNL", "Magento 2"], "license": "GPL-3.0-or-later", diff --git a/etc/module.xml b/etc/module.xml index c4558ecc..0851cb1d 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,5 +1,5 @@ - +