doctrine_annotation_braces.rst 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ===================================
  2. Rule ``doctrine_annotation_braces``
  3. ===================================
  4. Doctrine annotations without arguments must use the configured syntax.
  5. Configuration
  6. -------------
  7. ``ignored_tags``
  8. ~~~~~~~~~~~~~~~~
  9. List of tags that must not be treated as Doctrine Annotations.
  10. Allowed types: ``list<string>``
  11. Default value: ``['abstract', 'access', 'code', 'deprec', 'encode', 'exception', 'final', 'ingroup', 'inheritdoc', 'inheritDoc', 'magic', 'name', 'toc', 'tutorial', 'private', 'static', 'staticvar', 'staticVar', 'throw', 'api', 'author', 'category', 'copyright', 'deprecated', 'example', 'filesource', 'global', 'ignore', 'internal', 'license', 'link', 'method', 'package', 'param', 'property', 'property-read', 'property-write', 'return', 'see', 'since', 'source', 'subpackage', 'throws', 'todo', 'TODO', 'usedBy', 'uses', 'var', 'version', 'after', 'afterClass', 'backupGlobals', 'backupStaticAttributes', 'before', 'beforeClass', 'codeCoverageIgnore', 'codeCoverageIgnoreStart', 'codeCoverageIgnoreEnd', 'covers', 'coversDefaultClass', 'coversNothing', 'dataProvider', 'depends', 'expectedException', 'expectedExceptionCode', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp', 'group', 'large', 'medium', 'preserveGlobalState', 'requires', 'runTestsInSeparateProcesses', 'runInSeparateProcess', 'small', 'test', 'testdox', 'ticket', 'uses', 'SuppressWarnings', 'noinspection', 'package_version', 'enduml', 'startuml', 'psalm', 'phpstan', 'template', 'fix', 'FIXME', 'fixme', 'override']``
  12. ``syntax``
  13. ~~~~~~~~~~
  14. Whether to add or remove braces.
  15. Allowed values: ``'with_braces'`` and ``'without_braces'``
  16. Default value: ``'without_braces'``
  17. Examples
  18. --------
  19. Example #1
  20. ~~~~~~~~~~
  21. *Default* configuration.
  22. .. code-block:: diff
  23. --- Original
  24. +++ New
  25. <?php
  26. /**
  27. - * @Foo()
  28. + * @Foo
  29. */
  30. class Bar {}
  31. Example #2
  32. ~~~~~~~~~~
  33. With configuration: ``['syntax' => 'with_braces']``.
  34. .. code-block:: diff
  35. --- Original
  36. +++ New
  37. <?php
  38. /**
  39. - * @Foo
  40. + * @Foo()
  41. */
  42. class Bar {}
  43. Rule sets
  44. ---------
  45. The rule is part of the following rule set:
  46. - `@DoctrineAnnotation <./../../ruleSets/DoctrineAnnotation.rst>`_
  47. References
  48. ----------
  49. - Fixer class: `PhpCsFixer\\Fixer\\DoctrineAnnotation\\DoctrineAnnotationBracesFixer <./../../../src/Fixer/DoctrineAnnotation/DoctrineAnnotationBracesFixer.php>`_
  50. - Test class: `PhpCsFixer\\Tests\\Fixer\\DoctrineAnnotation\\DoctrineAnnotationBracesFixerTest <./../../../tests/Fixer/DoctrineAnnotation/DoctrineAnnotationBracesFixerTest.php>`_
  51. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.