Skip to content

Commit

Permalink
Update return value for CategoryManagerInterface::getRootCategory()
Browse files Browse the repository at this point in the history
… to `?CategoryInterface`
  • Loading branch information
phansys authored and jordisala1991 committed Oct 18, 2021
1 parent eb5e623 commit 961e51a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Command/FixMediaContextCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function execute(InputInterface $input, OutputInterface $output)
'id' => $context,
]);

if (!$defaultContext) {
if (null === $defaultContext) {
$output->writeln(sprintf(" > default context for '%s' is missing, creating one", $context));
$defaultContext = $this->contextManager->create();
$defaultContext->setId($context);
Expand All @@ -83,7 +83,7 @@ public function execute(InputInterface $input, OutputInterface $output)

$defaultCategory = $this->categoryManager->getRootCategory($defaultContext);

if (!$defaultCategory) {
if (null === $defaultCategory) {
$output->writeln(sprintf(" > default category for '%s' is missing, creating one", $context));
$defaultCategory = $this->categoryManager->create();
$defaultCategory->setContext($defaultContext);
Expand Down
2 changes: 1 addition & 1 deletion src/Model/CategoryManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(?ManagerInterface $categoryManager = null)
$this->categoryManager = $categoryManager;
}

public function getRootCategory($context): CategoryInterface
public function getRootCategory($context): ?CategoryInterface
{
return $this->categoryManager->getRootCategory($context);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/CategoryManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface CategoryManagerInterface
/**
* @param string $context
*
* @return CategoryInterface
* @return CategoryInterface|null
*/
public function getRootCategory($context);

Expand Down

0 comments on commit 961e51a

Please sign in to comment.