diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-10-10 12:38:58 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-10-15 10:38:21 +0200 |
commit | 4ff9b3e0ce53227e2be47c4c2dcb1fdc3e540b5f (patch) | |
tree | 77896d599bcac8d9f8db7d99d25d4060826d9c9e /build | |
parent | 28153443a55290877f4507a06b404f39c1cd6ec1 (diff) | |
download | nextcloud-server-4ff9b3e0ce53227e2be47c4c2dcb1fdc3e540b5f.tar.gz nextcloud-server-4ff9b3e0ce53227e2be47c4c2dcb1fdc3e540b5f.zip |
feat(rector): Skip classes with a name too common from auto use statement
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'build')
-rw-r--r-- | build/rector.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/build/rector.php b/build/rector.php index 9df995a0044..db39fb4ce48 100644 --- a/build/rector.php +++ b/build/rector.php @@ -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 |