From c7c683c2b4737cd42041041a8efa35531f89c623 Mon Sep 17 00:00:00 2001 From: bhavi-evrig Date: Wed, 27 Jul 2022 17:36:18 +0530 Subject: [PATCH] Compitability with php 8.1 --- src/Migration/Handler/CleanMultiselect.php | 2 +- src/Migration/Handler/Placeholder.php | 10 +++++++--- src/Migration/ResourceModel/AbstractCollection.php | 12 ++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Migration/Handler/CleanMultiselect.php b/src/Migration/Handler/CleanMultiselect.php index f1d8da24f..0059bfe10 100644 --- a/src/Migration/Handler/CleanMultiselect.php +++ b/src/Migration/Handler/CleanMultiselect.php @@ -51,7 +51,7 @@ public function handle(Record $recordToHandle, Record $oppositeRecord) { $attributeIds = $this->getAttributeIds(); if ($attributeIds && in_array($recordToHandle->getValue('attribute_id'), $attributeIds)) { - $value = $recordToHandle->getValue($this->field); + $value = $recordToHandle->getValue($this->field) ? $recordToHandle->getValue($this->field) : ''; $value = explode(',', $value); $value = array_filter($value); $value = implode(',', $value); diff --git a/src/Migration/Handler/Placeholder.php b/src/Migration/Handler/Placeholder.php index 028f021c5..5eae0fcd5 100644 --- a/src/Migration/Handler/Placeholder.php +++ b/src/Migration/Handler/Placeholder.php @@ -61,9 +61,13 @@ protected function processContent($content) $classSource = []; $classDestination = []; foreach ($this->classMap->getMap() as $classOldFashion => $classNewStyle) { - $classSource[] = sprintf('type="%s"', $classOldFashion); - $classNewStyle = $classNewStyle ?? ''; - $classDestination[] = sprintf('type="%s"', str_replace('\\', '\\\\', $classNewStyle)); + if($classNewStyle !== null) { + $classSource[] = sprintf('type="%s"', $classOldFashion); + $classDestination[] = sprintf('type="%s"', str_replace('\\', '\\\\', $classNewStyle)); + } else { + continue; + } + } $content = str_replace($classSource, $classDestination, $content); // cut off name of a module from template path diff --git a/src/Migration/ResourceModel/AbstractCollection.php b/src/Migration/ResourceModel/AbstractCollection.php index 21c1f3cd6..398ee7642 100644 --- a/src/Migration/ResourceModel/AbstractCollection.php +++ b/src/Migration/ResourceModel/AbstractCollection.php @@ -32,7 +32,7 @@ public function __construct(array $data = []) /** * @inheritdoc */ - public function current(): mixed + public function current():mixed { return $this->data[$this->position]; } @@ -40,7 +40,7 @@ public function current(): mixed /** * @inheritdoc */ - public function key(): mixed + public function key():mixed { return $this->position; } @@ -48,7 +48,7 @@ public function key(): mixed /** * @inheritdoc */ - public function next(): void + public function next():void { $this->position++; } @@ -56,7 +56,7 @@ public function next(): void /** * @inheritdoc */ - public function rewind(): void + public function rewind():void { $this->position = 0; } @@ -64,7 +64,7 @@ public function rewind(): void /** * @inheritdoc */ - public function valid(): bool + public function valid():bool { return $this->key() < count($this->data); } @@ -72,7 +72,7 @@ public function valid(): bool /** * @inheritdoc */ - public function count(): int + public function count():int { return count($this->data); }