Skip to content

Commit 54ddea6

Browse files
lvdhoornJelle van Oosterbosch
authored andcommitted
Added default return type array for getCategories in CampaignCategory
* Update CampaignCategory.php Removed array typecast on getCategories. If a category has no sub categories we where getting errors like this: Symfony\Component\Debug\Exception\FatalThrowableError: Return value of Hypeit\TradeTracker\Model\CampaignCategory::getCategories() must be of the type array, null returned * Update CampaignCategory.php Make response getCategories backwards compatible * Update CampaignCategory.php return type restriction on getCategories
1 parent 0f70259 commit 54ddea6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Model/CampaignCategory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function addCategory(CampaignCategory $category)
6464
*/
6565
public function getCategories(): array
6666
{
67-
return $this->categories;
67+
return $this->categories ?? [];
6868
}
6969

7070
/**

0 commit comments

Comments
 (0)