nikolaposa/version

Dependency injection

celorodovalho opened this issue · 2 comments

I wish I could your package as DI, but because of this:

final protected function __construct
...
return new static(

Is not possible.

Do you think there's a way to turn it compatible with CI?

nikolaposa/version provides a Value Object that is meant to be created on demand.
It's a newable class in contrast to a injectable class like a service or repository etc.
The following blog post has a nice explanation: https://qafoo.com/blog/111_injectables_newables.html

💯 what @bcremer said. Version is a value object, just like DateTime for example, it's not a service that you register with your DI container.