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

feature(is-registered): added a boolean method to indicate if a provider type or name is registered. #103

Merged
merged 2 commits into from
Jan 15, 2024

Conversation

gbtb16
Copy link
Owner

@gbtb16 gbtb16 commented Jan 15, 2024

Description

  • It was not possible to check whether a type T of instance or builder was registered in the kiwi global or scoped providers. This limited the ability to register instances only if they were not registered.

What has changed?

  • It is now possible to check if a provider is registered by its type and/or name.
    • Since previously there couldn't be two instances with the same registered type unless the second one had a name, it's safe to create this method that uses what was in _setProvider.

image

  • As mentioned in the comment of method, if an instance is defined with a name and you use the isRegistered method and do not pass its name, false will be returned if no instance was created with a name.

  • Since what was checked within _setProvider was reused, it was changed to use the isRegistered method to avoid unnecessary code repetition.

  • All 21 tests are passed correctly.

@gbtb16 gbtb16 added the feature New feature or request label Jan 15, 2024
@gbtb16 gbtb16 self-assigned this Jan 15, 2024
@gbtb16 gbtb16 merged commit 5cb8eb9 into master Jan 15, 2024
13 checks passed
@gbtb16 gbtb16 deleted the feature/is-registered branch January 15, 2024 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant