]> source.dussan.org Git - nextcloud-server.git/commitdiff
feat(rector): Skip classes with a name too common from auto use statement
authorCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 10 Oct 2024 10:38:58 +0000 (12:38 +0200)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Tue, 15 Oct 2024 08:38:21 +0000 (10:38 +0200)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
build/rector.php

index 9df995a00448642f26b75c5039fa98c77f9286e9..db39fb4ce485d8c5b349fdadfa5d4f49ee096036 100644 (file)
@@ -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