Skip to content

Commit

Permalink
Merge pull request #64 from magento-gl/Arrows_Bugfix_08072024
Browse files Browse the repository at this point in the history
[Arrows] Delivery for RFC: Deprecate passing null
  • Loading branch information
sidolov authored Aug 28, 2024
2 parents e28e651 + 371da7f commit d97e5ef
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogRuleSampleData/Model/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function convertSerializedData($data)
preg_match_all($regexp, $data, $matches);
$replacement = null;
foreach ($matches[1] as $matchedId => $matchedItem) {
$extractedData = array_filter(explode(",", $matchedItem));
$extractedData = array_filter(explode(",", $matchedItem ?? ''));
foreach ($extractedData as $extractedItem) {
$separatedData = array_filter(explode('=', $extractedItem));
if ($separatedData[0] == 'url_key') {
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/CatalogSampleData/Model/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function install(array $fixtures)
foreach ($rows as $row) {
$data = [];
foreach ($row as $key => $value) {
$data[$header[$key]] = trim($value);
$data[$header[$key]] = trim($value ?? '');
}
$data['attribute_set'] = explode("\n", $data['attribute_set']);

Expand Down Expand Up @@ -144,7 +144,7 @@ public function install(array $fixtures)

if (is_array($data['attribute_set'])) {
foreach ($data['attribute_set'] as $setName) {
$setName = trim($setName);
$setName = trim($setName ?? '');
$attributeCount++;
$attributeSet = $this->processAttributeSet($setName);
$attributeGroupId = $attributeSet->getDefaultGroupId();
Expand All @@ -171,7 +171,7 @@ public function install(array $fixtures)
protected function getOption($attribute, $data)
{
$result = [];
$data['option'] = explode("\n", $data['option']);
$data['option'] = explode("\n", $data['option'] ?? '');
/** @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection $options */
$options = $this->attrOptionCollectionFactory->create()
->setAttributeFilter($attribute->getId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected function getArrayValue($value)
if (is_array($value)) {
return $value;
}
if (false !== strpos($value, "\n")) {
if ($value !== null && false !== strpos($value, "\n")) {
$value = array_filter(explode("\n", $value));
}
return !is_array($value) ? [$value] : $value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected function convertAttributeValues($valuesData)
$values = [];
$prices = [];
foreach ($valuesData as $item) {
$itemData = explode(';', $item);
$itemData = explode(';', $item ?? '');
if (!empty($itemData[0])) {
$values[] = $itemData[0];
}
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/SwatchesSampleData/Model/Swatches.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ private function getOptionSwatchVisual(array $attributeData)
{
$optionSwatch = ['value' => []];
foreach ($attributeData['option'] as $optionKey => $optionValue) {
if (substr($optionValue, 0, 1) == '#' && strlen($optionValue) == 7) {
if ($optionValue !== null && substr($optionValue, 0, 1) == '#'
&& strlen($optionValue) == 7) {
$optionSwatch['value'][$optionKey] = $optionValue;
} else if (!empty($this->colorMap[$optionValue])) {
$optionSwatch['value'][$optionKey] = $this->colorMap[$optionValue];
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/ThemeSampleData/Model/HeadStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public function __construct(

public function add($contentFile, $cssFile)
{
$styleContent = preg_replace('/^\/\*[\s\S]+\*\//', '', file_get_contents($contentFile));
$styleContent = preg_replace('/^\/\*[\s\S]+\*\//', '',
file_get_contents($contentFile ?? ''));
if (empty($styleContent)) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/WishlistSampleData/Model/Wishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function install(array $fixtures)
if (!$wishlist->getId()) {
continue;
}
$productSkuList = explode("\n", $row['product_list']);
$productSkuList = explode("\n", $row['product_list'] ?? '');
$this->helper->addProductsToWishlist($wishlist, $productSkuList);
}
}
Expand Down

0 comments on commit d97e5ef

Please sign in to comment.