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

[11.x] Add php doc for ServiceProvider bindings and singletons properties #52298

Conversation

Anton5360
Copy link
Contributor

#52256 with no breaking change

@taylorotwell taylorotwell merged commit ff5cdef into laravel:11.x Jul 29, 2024
29 checks passed
Comment on lines +14 to +15
* @property array<class-string, class-string> $bindings All of the container bindings that should be registered.
* @property array<class-string, class-string> $singletons All of the singletons that should be registered.
Copy link
Contributor

Choose a reason for hiding this comment

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

These types are wrong, because bindings (and singletons) don't need to be class strings. They should be typehinted as string instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

I also suggest singletons' key to be array-key type, since integer is allowed:

foreach ($provider->singletons as $key => $value) {
$key = is_int($key) ? $value : $key;
$this->singleton($key, $value);
}

Copy link
Member

Choose a reason for hiding this comment

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

Feel free to send in follow up PR's 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants