- Issue created by @donquixote
- Merge request !10582Issue #3494360: Use ::class for class strings in plugin manager constructors. β (Open) created by donquixote
- π©πͺGermany donquixote
In case of name clash of the class alias (e.g. attribute vs annotation) we can use other shortcuts like `Annotation\Something`, where we might import the respective Annotation namespace.
Too bad...
Namespaced classes/interfaces/traits should be referenced with use statements
Alternative is to use an alias.
An example where the namespace import is used is Drush commands, where we have `use Drush\Attributes as CLI;` and then `#[CLI\Command(...)]`.
- π¨πSwitzerland berdir Switzerland
> I believe part of the reason that the Annotation class references weren't changed to ::class strings was that they were going to be gone with the removal of annotation discovery anyway, but since not all the plugins have been converted, it's probably going to be a while for that.
Exactly this. That was done on purpose, as we otherwise have two classes with the same name that we have to alias. That means we also need to adjust the use statements when we remove tem, which will make the cleanup more complex, with more risk of conflicts with other issues.
- π©πͺGermany donquixote
Exactly this. That was done on purpose, as we otherwise have two classes with the same name that we have to alias.
I removed the questionable commit.
- πΊπΈUnited States smustgrave
Appear to be some open threads. Believe itβs close
- π©πͺGermany donquixote
I removed imports reordering in those files where no new imports are added.
Looks like everything was addressed. PHP Unit Build job needs a re-run and we're probably there.
- πΊπΈUnited States smustgrave
So applied the MR and did a search for "$namespaces, $module_handler, 'Drupal\Core\" to make sure those were converted and all instances were.
@godotislate there is 1 thread I wasn't 100% should be resolved but your comment in #10 made think it maybe could? Could you close it.
There are 2 threads but really it's 1.
Rest of the feedback appears to be addressed so going to mark it.
@godotislate there is 1 thread I wasn't 100% should be resolved but your comment in #10 made think it maybe could? Could you close it.
It's not my MR, so I can't close it. But the question was resolved.
-
alexpott β
committed 84af9646 on 11.x
Issue #3494360 by donquixote, smustgrave, godotislate, berdir: Use ::...
-
alexpott β
committed 84af9646 on 11.x
- Status changed to Fixed
about 2 months ago 6:49pm 28 February 2025 Automatically closed - issue fixed for 2 weeks with no activity.