From 3e8c41e06e19f681beea4ceb9f976d2e7e816aea Mon Sep 17 00:00:00 2001 From: Adam Kadlec Date: Sat, 23 Apr 2022 00:06:49 +0200 Subject: [PATCH] QA fixes --- fastybird_devices_module/entities/device.py | 4 ++-- src/Entities/Devices/Attributes/Attribute.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fastybird_devices_module/entities/device.py b/fastybird_devices_module/entities/device.py index 76df039d..e5cd9396 100644 --- a/fastybird_devices_module/entities/device.py +++ b/fastybird_devices_module/entities/device.py @@ -957,8 +957,8 @@ def content( # pylint: disable=too-many-branches elif self.identifier == DeviceAttributeName.HARDWARE_MAC_ADDRESS.value: if ( content is not None - and len(re.findall("^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", content)) == 0 - and len(re.findall("^([0-9A-Fa-f]{12})$", content)) == 0 + and len(re.findall("^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", str(content))) == 0 + and len(re.findall("^([0-9A-Fa-f]{12})$", str(content))) == 0 ): raise InvalidArgumentException("Provided mac address is not in valid format") diff --git a/src/Entities/Devices/Attributes/Attribute.php b/src/Entities/Devices/Attributes/Attribute.php index 4d5ba22f..e70a2267 100644 --- a/src/Entities/Devices/Attributes/Attribute.php +++ b/src/Entities/Devices/Attributes/Attribute.php @@ -215,8 +215,8 @@ public function setContent($content): void } elseif ($this->getIdentifier() === MetadataTypes\DeviceAttributeNameType::ATTRIBUTE_HARDWARE_MAC_ADDRESS) { if ( $content !== null - && preg_match('/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/', $content) === 0 - && preg_match('/^([0-9A-Fa-f]{12})$/', $content) === 0 + && preg_match('/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/', (string) $content) === 0 + && preg_match('/^([0-9A-Fa-f]{12})$/', (string) $content) === 0 ) { throw new Exceptions\InvalidArgumentException('Provided mac address is not in valid format.'); }