Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add strict types to CategoryManager #466

Merged
merged 1 commit into from Sep 14, 2019

Conversation

core23
Copy link
Member

@core23 core23 commented Sep 11, 2019

Subject

I am targeting this branch, because this is a minor change.

Changelog

### Added
- Add strict types to CategoryManager

### Changed
- `CategoryManager::getRootCategory` will throw an exception if you pass invalid arguments

@core23 core23 added the minor label Sep 11, 2019
@core23 core23 requested a review from a team September 11, 2019 16:20
'Invalid parameter given: %s',
(string) $context
));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe avoid the repetition with

private function fromMixedTypeContext(?$context = null): ContextInterface
{
        if (null === $context || \is_string($context)) {
            return $this->getContext($context);
        }

        if ($context instanceof ContextInterface) {
            return $context;
        }

        throw new \InvalidArgumentException(sprintf(
            'Invalid parameter given: %s',
            (string) $context
        ));
}

@greg0ire greg0ire merged commit db1d771 into sonata-project:3.x Sep 14, 2019
@greg0ire
Copy link
Contributor

Thanks @core23 !

@core23 core23 deleted the minor/strict branch September 15, 2019 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants