Skip to content

Commit

Permalink
feat(rector): Skip classes with a name too common from auto use state…
Browse files Browse the repository at this point in the history
…ment

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc committed Oct 15, 2024
1 parent 2815344 commit 4ff9b3e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions build/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4ff9b3e

Please sign in to comment.