Skip to content

Conversation

@dereuromark
Copy link
Contributor

Summary

  • Remove PhpCollective\Sniffs\Commenting\AttributesSniff which required FQCN for PHP 8 attributes
  • Remove associated test files

Problem

The AttributesSniff required fully qualified class names (FQCN) for PHP 8 attributes, e.g.:

#[\PHPUnit\Framework\Attributes\DataProvider('foo')]

However, this conflicts with SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly which requires using short names via use statements:

use PHPUnit\Framework\Attributes\DataProvider;

#[DataProvider('foo')]

When both rules are active, phpcbf enters an infinite loop:

  1. AttributesSniff converts to FQCN
  2. ReferenceUsedNamesOnly converts back to short name with use statement
  3. Go to step 1

Solution

Remove the AttributesSniff to resolve this conflict. This aligns with the modern PHP convention of using short names with use statements for better:

  • Readability
  • IDE support (refactoring, find usages)
  • Consistency with the rest of the codebase

Test plan

  • Verify no infinite loop when running phpcs/phpcbf on files with PHP 8 attributes
  • Run existing test suite

🤖 Generated with Claude Code

…esOnly

The AttributesSniff required FQCN (fully qualified class names) for PHP 8
attributes, e.g. `#[\PHPUnit\Framework\Attributes\DataProvider('foo')]`.

However, this conflicts with SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly
which requires using short names via use statements.

When both rules are active, the auto-fixer enters an infinite loop:
1. AttributesSniff converts to FQCN
2. ReferenceUsedNamesOnly converts back to short name with use statement
3. Go to step 1

Removing the AttributesSniff resolves this conflict and aligns with the
modern PHP convention of using short names with use statements for better
readability and IDE support.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dereuromark dereuromark merged commit 2cce49d into master Nov 27, 2025
4 checks passed
@dereuromark dereuromark deleted the fix/attribute-fqcn-conflict branch November 27, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants