general_attribute_remove.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. =================================
  2. Rule ``general_attribute_remove``
  3. =================================
  4. Removes configured attributes by their respective FQN.
  5. Configuration
  6. -------------
  7. ``attributes``
  8. ~~~~~~~~~~~~~~
  9. List of FQNs of attributes for removal.
  10. Allowed types: ``list<class-string>``
  11. Default value: ``[]``
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. With configuration: ``['attributes' => ['\\A\\B\\Foo']]``.
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. <?php
  21. -#[\A\B\Foo]
  22. function foo() {}
  23. Example #2
  24. ~~~~~~~~~~
  25. With configuration: ``['attributes' => ['\\A\\B\\Foo', 'A\\B\\Bar']]``.
  26. .. code-block:: diff
  27. --- Original
  28. +++ New
  29. <?php
  30. use A\B\Bar as BarAlias;
  31. -#[\A\B\Foo]
  32. -#[BarAlias]
  33. function foo() {}
  34. References
  35. ----------
  36. - Fixer class: `PhpCsFixer\\Fixer\\AttributeNotation\\GeneralAttributeRemoveFixer <./../../../src/Fixer/AttributeNotation/GeneralAttributeRemoveFixer.php>`_
  37. - Test class: `PhpCsFixer\\Tests\\Fixer\\AttributeNotation\\GeneralAttributeRemoveFixerTest <./../../../tests/Fixer/AttributeNotation/GeneralAttributeRemoveFixerTest.php>`_
  38. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.