drupal-console
drupal-console copied to clipboard
Please use constructors for plugin creation.
Issue title
Please revert 4169 and return to using constructors
Problem/Motivation
- "Defines an interface for pulling plugin dependencies from the container." the concept is to pass them to the constructor.
- Inheritance binds your construction. Constructor BC may be the correct policy but if you extend a class you are accepting this BC bargain. It can change any dependency at any point and your extended version of the class can break. If you
- Testing is harder. Explicit dependencies are a core part of unit testing. With out them you can not effectively mock or test your class. Create doesn't fix this and and just adds a layer of indirection and complication to your testing because you have to build a container and inject it and track all of the parent class changes in your container building.
- Extension of your class becomes even more difficult because suddenly child classes can't rely on your constructor to instantiate your class anymore.