[phpMyAdmin Developers] Dependency Injection

Isaac Bennetch bennetch at gmail.com
Sat Jan 20 18:50:33 CET 2018



On 1/20/18 12:30 PM, Maurício Meneghini Fauth wrote:
> Hello.
> 
> This week I was researching how to increase code coverage and found a
> few things that would make it easier to write unit tests and make the
> code cleaner.
> 
> The main point is to use dependency injection whenever possible, as this
> makes it easier to mock the dependencies. To facilitate this, we can
> reduce the use of static methods in favor of instance methods. This
> would give us a constructor method, which would make it easier to manage
> dependencies.
> 
> Another point is that we currently use $GLOBALS as a simplified service
> locator. We can replace this with the dependency injection container.
> This would reduce the 'action at a distance' problems, in addition to
> decoupling the classes.
> 
> I would like to know what you think about it. Any feedback is welcome.
> 
> Maurício Meneghini Fauth

I don't feel comfortable enough with this area to make any comment or
suggestion. If you think it's better then I am fine with these improvements.



More information about the Developers mailing list