mirror of
https://github.com/nextcloud/server.git
synced 2026-02-19 02:38:40 -05:00
feat(rector): Skip classes with a name too common from auto use statement
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
28153443a5
commit
4ff9b3e0ce
1 changed files with 14 additions and 0 deletions
|
|
@ -21,7 +21,21 @@ class NextcloudNamespaceSkipVoter implements ClassNameImportSkipVoterInterface {
|
|||
'OCA',
|
||||
'OCP',
|
||||
];
|
||||
private array $skippedClassNames = [
|
||||
'Backend',
|
||||
'Connection',
|
||||
'Exception',
|
||||
'IManager',
|
||||
'IProvider',
|
||||
'Manager',
|
||||
'Plugin',
|
||||
'Provider',
|
||||
];
|
||||
public function shouldSkip(File $file, FullyQualifiedObjectType $fullyQualifiedObjectType, Node $node) : bool {
|
||||
if (in_array($fullyQualifiedObjectType->getShortName(), $this->skippedClassNames)) {
|
||||
// Skip common class names to avoid confusion
|
||||
return true;
|
||||
}
|
||||
foreach ($this->namespacePrefixes as $prefix) {
|
||||
if (str_starts_with($fullyQualifiedObjectType->getClassName(), $prefix . '\\')) {
|
||||
// Import Nextcloud namespaces
|
||||
|
|
|
|||
Loading…
Reference in a new issue