inpsyde / modularity

A PSR-11 implementation for WordPress Plugins, Themes or Libraries.
https://inpsyde.github.io/modularity/
GNU General Public License v2.0
44 stars 4 forks source link

Remove restricting to object for Services inside of the ReadOnlyContainer. #4

Closed Chrico closed 3 years ago

Chrico commented 3 years ago

Is your feature request related to a problem? Please describe. Currently our code restricts Services to be object when get and resolving internally the extensions via ReadOnlyContainer::resolveExtensions(string $id, object $service): object. This happens for Services comming from our own Modules but also for Services comming from external Containers

This currently does not allow full support for external PSR Containers, which do support mixed return values (eventho its not recommanded or offically documented).

Examples:


Describe the solution you'd like We should remove the object typehint on $service and also on the return type for this method. Additionally we should update the documentation to mention support of non-object values for Services with clarification that we do not recommand this.


pablok34 commented 3 years ago

This change is ok for me.

Chrico commented 3 years ago

Pull Request #5 is merged. We're going to prepare a 1.1 release.