Skip to content

Commit a7f5dc1

Browse files
committed
Autofix FQCN attributes.
1 parent 93bd146 commit a7f5dc1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

PhpCollective/Sniffs/Commenting/AttributesSniff.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,14 @@ public function process(File $phpcsFile, int $stackPtr): void
7070
if (isset($useStatements[$firstPart])) {
7171
// Found a use statement, construct the full name
7272
$useStatement = $useStatements[$firstPart];
73+
$fullName = (string)$useStatement['fullName'];
7374
if (str_contains($attributeName, '\\')) {
7475
// Replace first part with full name (e.g., Foo\Bar\Baz -> \Full\Namespace\Foo\Bar\Baz)
7576
$parts = explode('\\', $attributeName);
7677
array_shift($parts); // Remove first part
77-
$fullyQualifiedName = '\\' . $useStatement['fullName'] . (count($parts) > 0 ? '\\' . implode('\\', $parts) : '');
78+
$fullyQualifiedName = '\\' . $fullName . (count($parts) > 0 ? '\\' . implode('\\', $parts) : '');
7879
} else {
79-
$fullyQualifiedName = '\\' . $useStatement['fullName'];
80+
$fullyQualifiedName = '\\' . $fullName;
8081
}
8182
}
8283

0 commit comments

Comments
 (0)