-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report Drush 12 deprecations with command classes and drush.services.yml file #678
Comments
So anything which extends |
Only if the module that owns that command file has a drush.services.yml file for dependency injection. |
Because if they do not, it's assumed it doesn't need dependency injection? |
I think it depends if there is a drush.services.yml record for that class that contains |
As of, things have changed yet again: https://github.com/drush-ops/drush/releases/tag/12.5.0
|
I think this can be |
Well, I'm confused about the messaging from Drush about create() given that Drupal core also isn't strong on autowiring:
... vs the docs from https://www.drush.org/12.x/dependency-injection/:
I would caution to warn only if AutowireTrait and create() are not used, because otherwise I can't make a contrib drush command compatible with the current and previous major versions, which is personally what I target doing. |
@davereid - yeah create() is not part of the deprecation. Its more that Autowire is new and shiny and slightly preferred. Feel free to keep using create(). AFAICT autowire is very much available and recommended for Contrib. Its just Drupal core thats slow. |
Thanks for the input and clarifications! Right now we have: $servicesFileName = $module_dir . '/' . $module_name . '.services.yml';
if (file_exists($servicesFileName)) {
$this->serviceYamls[$module_name] = $servicesFileName;
} I guess we need the same for If the class name is found in the service map, via a I shouldn't need to check |
OK, but the presence of drush.services.yml should always trigger a warning. Its always good to remove it. If you have one AND you have autowire/create, you are doing the same work twice. Thats likely harmless, but its confusing where changes should be made. |
Yup, agreed. |
Perfect. Thanks! I hit major camp brain fog and fatigue before writing any code. But at least the requirements are now captured. I appreciate it! |
Feature request
If a site has written custom Drush commands using Drush 11 or lower, and they update to Drush 12, the drush.services.yml files are now deprecated as per https://www.drush.org/12.x/commands/
I guess I could write a rule for any classes that extend the DrushCommands class...
The text was updated successfully, but these errors were encountered: