Invalid output that can't compile for convert-di-to-inject with local and "public" dependencies
timdeschryver opened this issue ยท 0 comments
๐ thanks for this great library. Last week I've used the schematic to migrate our codebase to move away from constructors to inject
. I stumbled across this edge case, resulting in a project that couldn't be compiled anymore after running the convert-di-to-inject
migration.
If a dependency is used within the constructor AND outside of it, the this.
keyword isn't prefixed within the constructor. If the dependency is only used within the constructor this isn't a problem as the dependency will be created as a variable within the constructor.
The following output already shows this behavior (myService.doSomething();
needs to be this.myService.doSomething();
)
This can be fixed by moving the commented code to the else
block if the dependency is used outside the ctor.
If you want I can create a PR for this.