Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(rector): Skip classes with a name too common from auto use state…
…ment

Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Oct 15, 2024
commit 4ff9b3e0ce53227e2be47c4c2dcb1fdc3e540b5f
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