README.rst 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818
  1. PHP Coding Standards Fixer
  2. ==========================
  3. The PHP Coding Standards Fixer (PHP CS Fixer) tool fixes your code to follow standards;
  4. whether you want to follow PHP coding standards as defined in the PSR-1, PSR-2, etc.,
  5. or other community driven ones like the Symfony one.
  6. You can **also** define your (teams) style through configuration.
  7. It can modernize your code (like converting the ``pow`` function to the ``**`` operator on PHP 5.6)
  8. and (micro) optimize it.
  9. If you are already using a linter to identify coding standards problems in your
  10. code, you know that fixing them by hand is tedious, especially on large
  11. projects. This tool does not only detect them, but also fixes them for you.
  12. The PHP CS Fixer is maintained on GitHub at https://github.com/FriendsOfPHP/PHP-CS-Fixer
  13. bug reports and ideas about new features are welcome there.
  14. You can talk to us at https://gitter.im/PHP-CS-Fixer/Lobby about the project,
  15. configuration, possible improvements, ideas and questions, please visit us!
  16. Requirements
  17. ------------
  18. PHP needs to be a minimum version of PHP 5.6.0.
  19. Installation
  20. ------------
  21. Locally
  22. ~~~~~~~
  23. Download the `php-cs-fixer.phar`_ file and store it somewhere on your computer.
  24. Globally (manual)
  25. ~~~~~~~~~~~~~~~~~
  26. You can run these commands to easily access latest ``php-cs-fixer`` from anywhere on
  27. your system:
  28. .. code-block:: bash
  29. $ wget https://cs.sensiolabs.org/download/php-cs-fixer-v2.phar -O php-cs-fixer
  30. or with specified version:
  31. .. code-block:: bash
  32. $ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.11.1/php-cs-fixer.phar -O php-cs-fixer
  33. or with curl:
  34. .. code-block:: bash
  35. $ curl -L https://cs.sensiolabs.org/download/php-cs-fixer-v2.phar -o php-cs-fixer
  36. then:
  37. .. code-block:: bash
  38. $ sudo chmod a+x php-cs-fixer
  39. $ sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer
  40. Then, just run ``php-cs-fixer``.
  41. Globally (Composer)
  42. ~~~~~~~~~~~~~~~~~~~
  43. To install PHP CS Fixer, `install Composer <https://getcomposer.org/download/>`_ and issue the following command:
  44. .. code-block:: bash
  45. $ composer global require friendsofphp/php-cs-fixer
  46. Then make sure you have the global Composer binaries directory in your ``PATH``. This directory is platform-dependent, see `Composer documentation <https://getcomposer.org/doc/03-cli.md#composer-home>`_ for details. Example for some Unix systems:
  47. .. code-block:: bash
  48. $ export PATH="$PATH:$HOME/.composer/vendor/bin"
  49. Globally (homebrew)
  50. ~~~~~~~~~~~~~~~~~~~
  51. .. code-block:: bash
  52. $ brew install php-cs-fixer
  53. Update
  54. ------
  55. Locally
  56. ~~~~~~~
  57. The ``self-update`` command tries to update ``php-cs-fixer`` itself:
  58. .. code-block:: bash
  59. $ php php-cs-fixer.phar self-update
  60. Globally (manual)
  61. ~~~~~~~~~~~~~~~~~
  62. You can update ``php-cs-fixer`` through this command:
  63. .. code-block:: bash
  64. $ sudo php-cs-fixer self-update
  65. Globally (Composer)
  66. ~~~~~~~~~~~~~~~~~~~
  67. You can update ``php-cs-fixer`` through this command:
  68. .. code-block:: bash
  69. $ ./composer.phar global update friendsofphp/php-cs-fixer
  70. Globally (homebrew)
  71. ~~~~~~~~~~~~~~~~~~~
  72. You can update ``php-cs-fixer`` through this command:
  73. .. code-block:: bash
  74. $ brew upgrade php-cs-fixer
  75. Usage
  76. -----
  77. The ``fix`` command tries to fix as much coding standards
  78. problems as possible on a given file or files in a given directory and its subdirectories:
  79. .. code-block:: bash
  80. $ php php-cs-fixer.phar fix /path/to/dir
  81. $ php php-cs-fixer.phar fix /path/to/file
  82. By default ``--path-mode`` is set to ``override``, which means, that if you specify the path to a file or a directory via
  83. command arguments, then the paths provided to a ``Finder`` in config file will be ignored. You can use ``--path-mode=intersection``
  84. to merge paths from the config file and from the argument:
  85. .. code-block:: bash
  86. $ php php-cs-fixer.phar fix --path-mode=intersection /path/to/dir
  87. The ``--format`` option for the output format. Supported formats are ``txt`` (default one), ``json``, ``xml``, ``checkstyle`` and ``junit``.
  88. NOTE: the output for the following formats are generated in accordance with XML schemas
  89. * ``junit`` follows the `JUnit xml schema from Jenkins </doc/junit-10.xsd>`_
  90. * ``checkstyle`` follows the common `"checkstyle" xml schema </doc/checkstyle.xsd>`_
  91. The ``--verbose`` option will show the applied rules. When using the ``txt`` format it will also displays progress notifications.
  92. The ``--rules`` option limits the rules to apply on the
  93. project:
  94. .. code-block:: bash
  95. $ php php-cs-fixer.phar fix /path/to/project --rules=@PSR2
  96. By default the PSR1 and PSR2 rules are used.
  97. The ``--rules`` option lets you choose the exact rules to
  98. apply (the rule names must be separated by a comma):
  99. .. code-block:: bash
  100. $ php php-cs-fixer.phar fix /path/to/dir --rules=line_ending,full_opening_tag,indentation_type
  101. You can also blacklist the rules you don't want by placing a dash in front of the rule name, if this is more convenient,
  102. using ``-name_of_fixer``:
  103. .. code-block:: bash
  104. $ php php-cs-fixer.phar fix /path/to/dir --rules=-full_opening_tag,-indentation_type
  105. When using combinations of exact and blacklist rules, applying exact rules along with above blacklisted results:
  106. .. code-block:: bash
  107. $ php php-cs-fixer.phar fix /path/to/project --rules=@Symfony,-@PSR1,-blank_line_before_statement,strict_comparison
  108. Complete configuration for rules can be supplied using a ``json`` formatted string.
  109. .. code-block:: bash
  110. $ php php-cs-fixer.phar fix /path/to/project --rules='{"concat_space": {"spacing": "none"}}'
  111. The ``--dry-run`` flag will run the fixer without making changes to your files.
  112. The ``--diff`` flag can be used to let the fixer output all the changes it makes.
  113. The ``--diff-format`` option allows to specify in which format the fixer should output the changes it makes:
  114. * ``null``: no diff;
  115. * ``udiff``: unified diff format.
  116. The ``--allow-risky`` option (pass ``yes`` or ``no``) allows you to set whether risky rules may run. Default value is taken from config file.
  117. Risky rule is a rule, which could change code behaviour. By default no risky rules are run.
  118. The ``--stop-on-violation`` flag stops the execution upon first file that needs to be fixed.
  119. The ``--show-progress`` option allows you to choose the way process progress is rendered:
  120. * ``none``: disables progress output;
  121. * ``dots``: multiline progress output with number of files and percentage on each line.
  122. If the option is not provided, it defaults to ``dots`` unless a config file that disables output is used, in which case it defaults to ``none``. This option has no effect if the verbosity of the command is less than ``verbose``.
  123. .. code-block:: bash
  124. $ php php-cs-fixer.phar fix --verbose --show-progress=dots
  125. The command can also read from standard input, in which case it won't
  126. automatically fix anything:
  127. .. code-block:: bash
  128. $ cat foo.php | php php-cs-fixer.phar fix --diff -
  129. Finally, if you don't need BC kept on CLI level, you might use `PHP_CS_FIXER_FUTURE_MODE` to start using options that
  130. would be default in next MAJOR release (unified differ, dots, full-width progress indicator):
  131. .. code-block:: bash
  132. $ PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer.phar fix -v --diff
  133. Choose from the list of available rules:
  134. * **align_multiline_comment**
  135. Each line of multi-line DocComments must have an asterisk [PSR-5] and
  136. must be aligned with the first one.
  137. Configuration options:
  138. - ``comment_type`` (``'all_multiline'``, ``'phpdocs_like'``, ``'phpdocs_only'``): whether
  139. to fix PHPDoc comments only (``phpdocs_only``), any multi-line comment
  140. whose lines all start with an asterisk (``phpdocs_like``) or any
  141. multi-line comment (``all_multiline``); defaults to ``'phpdocs_only'``
  142. * **array_indentation**
  143. Each element of an array must be indented exactly once.
  144. * **array_syntax**
  145. PHP arrays should be declared using the configured syntax.
  146. Configuration options:
  147. - ``syntax`` (``'long'``, ``'short'``): whether to use the ``long`` or ``short`` array
  148. syntax; defaults to ``'long'``
  149. * **backtick_to_shell_exec**
  150. Converts backtick operators to ``shell_exec`` calls.
  151. * **binary_operator_spaces** [@Symfony]
  152. Binary operators should be surrounded by space as configured.
  153. Configuration options:
  154. - ``default`` (``'align'``, ``'align_single_space'``, ``'align_single_space_minimal'``,
  155. ``'single_space'``, ``null``): default fix strategy; defaults to ``'single_space'``
  156. - ``operators`` (``array``): dictionary of ``binary operator`` => ``fix strategy``
  157. values that differ from the default strategy; defaults to ``[]``
  158. * **blank_line_after_namespace** [@PSR2, @Symfony]
  159. There MUST be one blank line after the namespace declaration.
  160. * **blank_line_after_opening_tag** [@Symfony]
  161. Ensure there is no code on the same line as the PHP open tag and it is
  162. followed by a blank line.
  163. * **blank_line_before_statement** [@Symfony]
  164. An empty line feed must precede any configured statement.
  165. Configuration options:
  166. - ``statements`` (a subset of ``['break', 'case', 'continue', 'declare',
  167. 'default', 'die', 'do', 'exit', 'for', 'foreach', 'goto', 'if',
  168. 'include', 'include_once', 'require', 'require_once', 'return',
  169. 'switch', 'throw', 'try', 'while', 'yield']``): list of statements which
  170. must be preceded by an empty line; defaults to ``['break', 'continue',
  171. 'declare', 'return', 'throw', 'try']``
  172. * **braces** [@PSR2, @Symfony]
  173. The body of each structure MUST be enclosed by braces. Braces should be
  174. properly placed. Body of braces should be properly indented.
  175. Configuration options:
  176. - ``allow_single_line_closure`` (``bool``): whether single line lambda notation
  177. should be allowed; defaults to ``false``
  178. - ``position_after_anonymous_constructs`` (``'next'``, ``'same'``): whether the
  179. opening brace should be placed on "next" or "same" line after anonymous
  180. constructs (anonymous classes and lambda functions); defaults to ``'same'``
  181. - ``position_after_control_structures`` (``'next'``, ``'same'``): whether the opening
  182. brace should be placed on "next" or "same" line after control
  183. structures; defaults to ``'same'``
  184. - ``position_after_functions_and_oop_constructs`` (``'next'``, ``'same'``): whether
  185. the opening brace should be placed on "next" or "same" line after
  186. classy constructs (non-anonymous classes, interfaces, traits, methods
  187. and non-lambda functions); defaults to ``'next'``
  188. * **cast_spaces** [@Symfony]
  189. A single space or none should be between cast and variable.
  190. Configuration options:
  191. - ``space`` (``'none'``, ``'single'``): spacing to apply between cast and variable;
  192. defaults to ``'single'``
  193. * **class_attributes_separation** [@Symfony]
  194. Class, trait and interface elements must be separated with one blank
  195. line.
  196. Configuration options:
  197. - ``elements`` (a subset of ``['const', 'method', 'property']``): list of classy
  198. elements; 'const', 'method', 'property'; defaults to ``['const',
  199. 'method', 'property']``
  200. * **class_definition** [@PSR2, @Symfony]
  201. Whitespace around the keywords of a class, trait or interfaces
  202. definition should be one space.
  203. Configuration options:
  204. - ``multi_line_extends_each_single_line`` (``bool``): whether definitions should
  205. be multiline; defaults to ``false``; DEPRECATED alias:
  206. ``multiLineExtendsEachSingleLine``
  207. - ``single_item_single_line`` (``bool``): whether definitions should be single
  208. line when including a single item; defaults to ``false``; DEPRECATED alias:
  209. ``singleItemSingleLine``
  210. - ``single_line`` (``bool``): whether definitions should be single line; defaults
  211. to ``false``; DEPRECATED alias: ``singleLine``
  212. * **class_keyword_remove**
  213. Converts ``::class`` keywords to FQCN strings.
  214. * **combine_consecutive_issets**
  215. Using ``isset($var) &&`` multiple times should be done in one call.
  216. * **combine_consecutive_unsets**
  217. Calling ``unset`` on multiple items should be done in one call.
  218. * **comment_to_phpdoc**
  219. Comments with annotation should be docblock when used on structural
  220. elements.
  221. *Risky rule: risky as new docblocks might mean more, e.g. a Doctrine entity might have a new column in database.*
  222. * **compact_nullable_typehint**
  223. Remove extra spaces in a nullable typehint.
  224. * **concat_space** [@Symfony]
  225. Concatenation should be spaced according configuration.
  226. Configuration options:
  227. - ``spacing`` (``'none'``, ``'one'``): spacing to apply around concatenation operator;
  228. defaults to ``'none'``
  229. * **date_time_immutable**
  230. Class ``DateTimeImmutable`` should be used instead of ``DateTime``.
  231. *Risky rule: risky when the code relies on modifying ``DateTime`` objects or if any of the ``date_create*`` functions are overridden.*
  232. * **declare_equal_normalize** [@Symfony]
  233. Equal sign in declare statement should be surrounded by spaces or not
  234. following configuration.
  235. Configuration options:
  236. - ``space`` (``'none'``, ``'single'``): spacing to apply around the equal sign;
  237. defaults to ``'none'``
  238. * **declare_strict_types** [@PHP70Migration:risky, @PHP71Migration:risky]
  239. Force strict types declaration in all files. Requires PHP >= 7.0.
  240. *Risky rule: forcing strict types will stop non strict code from working.*
  241. * **dir_constant** [@Symfony:risky]
  242. Replaces ``dirname(__FILE__)`` expression with equivalent ``__DIR__``
  243. constant.
  244. *Risky rule: risky when the function ``dirname`` is overridden.*
  245. * **doctrine_annotation_array_assignment** [@DoctrineAnnotation]
  246. Doctrine annotations must use configured operator for assignment in
  247. arrays.
  248. Configuration options:
  249. - ``ignored_tags`` (``array``): list of tags that must not be treated as Doctrine
  250. Annotations; defaults to ``['abstract', 'access', 'code', 'deprec',
  251. 'encode', 'exception', 'final', 'ingroup', 'inheritdoc', 'inheritDoc',
  252. 'magic', 'name', 'toc', 'tutorial', 'private', 'static', 'staticvar',
  253. 'staticVar', 'throw', 'api', 'author', 'category', 'copyright',
  254. 'deprecated', 'example', 'filesource', 'global', 'ignore', 'internal',
  255. 'license', 'link', 'method', 'package', 'param', 'property',
  256. 'property-read', 'property-write', 'return', 'see', 'since', 'source',
  257. 'subpackage', 'throws', 'todo', 'TODO', 'usedBy', 'uses', 'var',
  258. 'version', 'after', 'afterClass', 'backupGlobals',
  259. 'backupStaticAttributes', 'before', 'beforeClass',
  260. 'codeCoverageIgnore', 'codeCoverageIgnoreStart',
  261. 'codeCoverageIgnoreEnd', 'covers', 'coversDefaultClass',
  262. 'coversNothing', 'dataProvider', 'depends', 'expectedException',
  263. 'expectedExceptionCode', 'expectedExceptionMessage',
  264. 'expectedExceptionMessageRegExp', 'group', 'large', 'medium',
  265. 'preserveGlobalState', 'requires', 'runTestsInSeparateProcesses',
  266. 'runInSeparateProcess', 'small', 'test', 'testdox', 'ticket', 'uses',
  267. 'SuppressWarnings', 'noinspection', 'package_version', 'enduml',
  268. 'startuml', 'fix', 'FIXME', 'fixme', 'override']``
  269. - ``operator`` (``':'``, ``'='``): the operator to use; defaults to ``'='``
  270. * **doctrine_annotation_braces** [@DoctrineAnnotation]
  271. Doctrine annotations without arguments must use the configured syntax.
  272. Configuration options:
  273. - ``ignored_tags`` (``array``): list of tags that must not be treated as Doctrine
  274. Annotations; defaults to ``['abstract', 'access', 'code', 'deprec',
  275. 'encode', 'exception', 'final', 'ingroup', 'inheritdoc', 'inheritDoc',
  276. 'magic', 'name', 'toc', 'tutorial', 'private', 'static', 'staticvar',
  277. 'staticVar', 'throw', 'api', 'author', 'category', 'copyright',
  278. 'deprecated', 'example', 'filesource', 'global', 'ignore', 'internal',
  279. 'license', 'link', 'method', 'package', 'param', 'property',
  280. 'property-read', 'property-write', 'return', 'see', 'since', 'source',
  281. 'subpackage', 'throws', 'todo', 'TODO', 'usedBy', 'uses', 'var',
  282. 'version', 'after', 'afterClass', 'backupGlobals',
  283. 'backupStaticAttributes', 'before', 'beforeClass',
  284. 'codeCoverageIgnore', 'codeCoverageIgnoreStart',
  285. 'codeCoverageIgnoreEnd', 'covers', 'coversDefaultClass',
  286. 'coversNothing', 'dataProvider', 'depends', 'expectedException',
  287. 'expectedExceptionCode', 'expectedExceptionMessage',
  288. 'expectedExceptionMessageRegExp', 'group', 'large', 'medium',
  289. 'preserveGlobalState', 'requires', 'runTestsInSeparateProcesses',
  290. 'runInSeparateProcess', 'small', 'test', 'testdox', 'ticket', 'uses',
  291. 'SuppressWarnings', 'noinspection', 'package_version', 'enduml',
  292. 'startuml', 'fix', 'FIXME', 'fixme', 'override']``
  293. - ``syntax`` (``'with_braces'``, ``'without_braces'``): whether to add or remove
  294. braces; defaults to ``'without_braces'``
  295. * **doctrine_annotation_indentation** [@DoctrineAnnotation]
  296. Doctrine annotations must be indented with four spaces.
  297. Configuration options:
  298. - ``ignored_tags`` (``array``): list of tags that must not be treated as Doctrine
  299. Annotations; defaults to ``['abstract', 'access', 'code', 'deprec',
  300. 'encode', 'exception', 'final', 'ingroup', 'inheritdoc', 'inheritDoc',
  301. 'magic', 'name', 'toc', 'tutorial', 'private', 'static', 'staticvar',
  302. 'staticVar', 'throw', 'api', 'author', 'category', 'copyright',
  303. 'deprecated', 'example', 'filesource', 'global', 'ignore', 'internal',
  304. 'license', 'link', 'method', 'package', 'param', 'property',
  305. 'property-read', 'property-write', 'return', 'see', 'since', 'source',
  306. 'subpackage', 'throws', 'todo', 'TODO', 'usedBy', 'uses', 'var',
  307. 'version', 'after', 'afterClass', 'backupGlobals',
  308. 'backupStaticAttributes', 'before', 'beforeClass',
  309. 'codeCoverageIgnore', 'codeCoverageIgnoreStart',
  310. 'codeCoverageIgnoreEnd', 'covers', 'coversDefaultClass',
  311. 'coversNothing', 'dataProvider', 'depends', 'expectedException',
  312. 'expectedExceptionCode', 'expectedExceptionMessage',
  313. 'expectedExceptionMessageRegExp', 'group', 'large', 'medium',
  314. 'preserveGlobalState', 'requires', 'runTestsInSeparateProcesses',
  315. 'runInSeparateProcess', 'small', 'test', 'testdox', 'ticket', 'uses',
  316. 'SuppressWarnings', 'noinspection', 'package_version', 'enduml',
  317. 'startuml', 'fix', 'FIXME', 'fixme', 'override']``
  318. - ``indent_mixed_lines`` (``bool``): whether to indent lines that have content
  319. before closing parenthesis; defaults to ``false``
  320. * **doctrine_annotation_spaces** [@DoctrineAnnotation]
  321. Fixes spaces in Doctrine annotations.
  322. Configuration options:
  323. - ``after_argument_assignments`` (``null``, ``bool``): whether to add, remove or
  324. ignore spaces after argument assignment operator; defaults to ``false``
  325. - ``after_array_assignments_colon`` (``null``, ``bool``): whether to add, remove or
  326. ignore spaces after array assignment ``:`` operator; defaults to ``true``
  327. - ``after_array_assignments_equals`` (``null``, ``bool``): whether to add, remove or
  328. ignore spaces after array assignment ``=`` operator; defaults to ``true``
  329. - ``around_commas`` (``bool``): whether to fix spaces around commas; defaults to
  330. ``true``
  331. - ``around_parentheses`` (``bool``): whether to fix spaces around parentheses;
  332. defaults to ``true``
  333. - ``before_argument_assignments`` (``null``, ``bool``): whether to add, remove or
  334. ignore spaces before argument assignment operator; defaults to ``false``
  335. - ``before_array_assignments_colon`` (``null``, ``bool``): whether to add, remove or
  336. ignore spaces before array ``:`` assignment operator; defaults to ``true``
  337. - ``before_array_assignments_equals`` (``null``, ``bool``): whether to add, remove or
  338. ignore spaces before array ``=`` assignment operator; defaults to ``true``
  339. - ``ignored_tags`` (``array``): list of tags that must not be treated as Doctrine
  340. Annotations; defaults to ``['abstract', 'access', 'code', 'deprec',
  341. 'encode', 'exception', 'final', 'ingroup', 'inheritdoc', 'inheritDoc',
  342. 'magic', 'name', 'toc', 'tutorial', 'private', 'static', 'staticvar',
  343. 'staticVar', 'throw', 'api', 'author', 'category', 'copyright',
  344. 'deprecated', 'example', 'filesource', 'global', 'ignore', 'internal',
  345. 'license', 'link', 'method', 'package', 'param', 'property',
  346. 'property-read', 'property-write', 'return', 'see', 'since', 'source',
  347. 'subpackage', 'throws', 'todo', 'TODO', 'usedBy', 'uses', 'var',
  348. 'version', 'after', 'afterClass', 'backupGlobals',
  349. 'backupStaticAttributes', 'before', 'beforeClass',
  350. 'codeCoverageIgnore', 'codeCoverageIgnoreStart',
  351. 'codeCoverageIgnoreEnd', 'covers', 'coversDefaultClass',
  352. 'coversNothing', 'dataProvider', 'depends', 'expectedException',
  353. 'expectedExceptionCode', 'expectedExceptionMessage',
  354. 'expectedExceptionMessageRegExp', 'group', 'large', 'medium',
  355. 'preserveGlobalState', 'requires', 'runTestsInSeparateProcesses',
  356. 'runInSeparateProcess', 'small', 'test', 'testdox', 'ticket', 'uses',
  357. 'SuppressWarnings', 'noinspection', 'package_version', 'enduml',
  358. 'startuml', 'fix', 'FIXME', 'fixme', 'override']``
  359. * **elseif** [@PSR2, @Symfony]
  360. The keyword ``elseif`` should be used instead of ``else if`` so that all
  361. control keywords look like single words.
  362. * **encoding** [@PSR1, @PSR2, @Symfony]
  363. PHP code MUST use only UTF-8 without BOM (remove BOM).
  364. * **ereg_to_preg** [@Symfony:risky]
  365. Replace deprecated ``ereg`` regular expression functions with ``preg``.
  366. *Risky rule: risky if the ``ereg`` function is overridden.*
  367. * **error_suppression** [@Symfony:risky]
  368. Error control operator should be added to deprecation notices and/or
  369. removed from other cases.
  370. *Risky rule: risky because adding/removing ``@`` might cause changes to code behaviour or if ``trigger_error`` function is overridden.*
  371. Configuration options:
  372. - ``mute_deprecation_error`` (``bool``): whether to add ``@`` in deprecation
  373. notices; defaults to ``true``
  374. - ``noise_remaining_usages`` (``bool``): whether to remove ``@`` in remaining
  375. usages; defaults to ``false``
  376. - ``noise_remaining_usages_exclude`` (``array``): list of global functions to
  377. exclude from removing ``@``; defaults to ``[]``
  378. * **escape_implicit_backslashes**
  379. Escape implicit backslashes in strings and heredocs to ease the
  380. understanding of which are special chars interpreted by PHP and which
  381. not.
  382. Configuration options:
  383. - ``double_quoted`` (``bool``): whether to fix double-quoted strings; defaults to
  384. ``true``
  385. - ``heredoc_syntax`` (``bool``): whether to fix heredoc syntax; defaults to ``true``
  386. - ``single_quoted`` (``bool``): whether to fix single-quoted strings; defaults to
  387. ``false``
  388. * **explicit_indirect_variable**
  389. Add curly braces to indirect variables to make them clear to understand.
  390. Requires PHP >= 7.0.
  391. * **explicit_string_variable**
  392. Converts implicit variables into explicit ones in double-quoted strings
  393. or heredoc syntax.
  394. * **final_internal_class**
  395. Internal classes should be ``final``.
  396. *Risky rule: changing classes to ``final`` might cause code execution to break.*
  397. Configuration options:
  398. - ``annotation-black-list`` (``array``): class level annotations tags that must be
  399. omitted to fix the class, even if all of the white list ones are used
  400. as well. (case insensitive); defaults to ``['@final', '@Entity', '@ORM']``
  401. - ``annotation-white-list`` (``array``): class level annotations tags that must be
  402. set in order to fix the class. (case insensitive); defaults to
  403. ``['@internal']``
  404. * **full_opening_tag** [@PSR1, @PSR2, @Symfony]
  405. PHP code must use the long ``<?php`` tags or short-echo ``<?=`` tags and not
  406. other tag variations.
  407. * **fully_qualified_strict_types**
  408. Transforms imported FQCN parameters and return types in function
  409. arguments to short version.
  410. * **function_declaration** [@PSR2, @Symfony]
  411. Spaces should be properly placed in a function declaration.
  412. Configuration options:
  413. - ``closure_function_spacing`` (``'none'``, ``'one'``): spacing to use before open
  414. parenthesis for closures; defaults to ``'one'``
  415. * **function_to_constant** [@Symfony:risky]
  416. Replace core functions calls returning constants with the constants.
  417. *Risky rule: risky when any of the configured functions to replace are overridden.*
  418. Configuration options:
  419. - ``functions`` (a subset of ``['get_called_class', 'get_class',
  420. 'php_sapi_name', 'phpversion', 'pi']``): list of function names to fix;
  421. defaults to ``['get_called_class', 'get_class', 'php_sapi_name',
  422. 'phpversion', 'pi']``
  423. * **function_typehint_space** [@Symfony]
  424. Add missing space between function's argument and its typehint.
  425. * **general_phpdoc_annotation_remove**
  426. Configured annotations should be omitted from PHPDoc.
  427. Configuration options:
  428. - ``annotations`` (``array``): list of annotations to remove, e.g. ``["author"]``;
  429. defaults to ``[]``
  430. * **header_comment**
  431. Add, replace or remove header comment.
  432. Configuration options:
  433. - ``comment_type`` (``'comment'``, ``'PHPDoc'``): comment syntax type; defaults to
  434. ``'comment'``; DEPRECATED alias: ``commentType``
  435. - ``header`` (``string``): proper header content; required
  436. - ``location`` (``'after_declare_strict'``, ``'after_open'``): the location of the
  437. inserted header; defaults to ``'after_declare_strict'``
  438. - ``separate`` (``'both'``, ``'bottom'``, ``'none'``, ``'top'``): whether the header should be
  439. separated from the file content with a new line; defaults to ``'both'``
  440. * **heredoc_to_nowdoc**
  441. Convert ``heredoc`` to ``nowdoc`` where possible.
  442. * **include** [@Symfony]
  443. Include/Require and file path should be divided with a single space.
  444. File path should not be placed under brackets.
  445. * **increment_style** [@Symfony]
  446. Pre- or post-increment and decrement operators should be used if
  447. possible.
  448. Configuration options:
  449. - ``style`` (``'post'``, ``'pre'``): whether to use pre- or post-increment and
  450. decrement operators; defaults to ``'pre'``
  451. * **indentation_type** [@PSR2, @Symfony]
  452. Code MUST use configured indentation type.
  453. * **is_null** [@Symfony:risky]
  454. Replaces ``is_null($var)`` expression with ``null === $var``.
  455. *Risky rule: risky when the function ``is_null`` is overridden.*
  456. * **line_ending** [@PSR2, @Symfony]
  457. All PHP files must use same line ending.
  458. * **linebreak_after_opening_tag**
  459. Ensure there is no code on the same line as the PHP open tag.
  460. * **list_syntax**
  461. List (``array`` destructuring) assignment should be declared using the
  462. configured syntax. Requires PHP >= 7.1.
  463. Configuration options:
  464. - ``syntax`` (``'long'``, ``'short'``): whether to use the ``long`` or ``short`` ``list``
  465. syntax; defaults to ``'long'``
  466. * **logical_operators**
  467. Use ``&&`` and ``||`` logical operators instead of ``and`` and ``or``.
  468. *Risky rule: risky, because you must double-check if using and/or with lower precedence was intentional.*
  469. * **lowercase_cast** [@Symfony]
  470. Cast should be written in lower case.
  471. * **lowercase_constants** [@PSR2, @Symfony]
  472. The PHP constants ``true``, ``false``, and ``null`` MUST be in lower case.
  473. * **lowercase_keywords** [@PSR2, @Symfony]
  474. PHP keywords MUST be in lower case.
  475. * **lowercase_static_reference** [@Symfony]
  476. Class static references ``self``, ``static`` and ``parent`` MUST be in lower
  477. case.
  478. * **magic_constant_casing** [@Symfony]
  479. Magic constants should be referred to using the correct casing.
  480. * **mb_str_functions**
  481. Replace non multibyte-safe functions with corresponding mb function.
  482. *Risky rule: risky when any of the functions are overridden.*
  483. * **method_argument_space** [@PSR2, @Symfony]
  484. In method arguments and method call, there MUST NOT be a space before
  485. each comma and there MUST be one space after each comma. Argument lists
  486. MAY be split across multiple lines, where each subsequent line is
  487. indented once. When doing so, the first item in the list MUST be on the
  488. next line, and there MUST be only one argument per line.
  489. Configuration options:
  490. - ``ensure_fully_multiline`` (``bool``): ensure every argument of a multiline
  491. argument list is on its own line; defaults to ``true``
  492. - ``keep_multiple_spaces_after_comma`` (``bool``): whether keep multiple spaces
  493. after comma; defaults to ``false``
  494. * **method_chaining_indentation**
  495. Method chaining MUST be properly indented. Method chaining with
  496. different levels of indentation is not supported.
  497. * **modernize_types_casting** [@Symfony:risky]
  498. Replaces ``intval``, ``floatval``, ``doubleval``, ``strval`` and ``boolval``
  499. function calls with according type casting operator.
  500. *Risky rule: risky if any of the functions ``intval``, ``floatval``, ``doubleval``, ``strval`` or ``boolval`` are overridden.*
  501. * **multiline_comment_opening_closing**
  502. DocBlocks must start with two asterisks, multiline comments must start
  503. with a single asterisk, after the opening slash. Both must end with a
  504. single asterisk before the closing slash.
  505. * **multiline_whitespace_before_semicolons**
  506. Forbid multi-line whitespace before the closing semicolon or move the
  507. semicolon to the new line for chained calls.
  508. Configuration options:
  509. - ``strategy`` (``'new_line_for_chained_calls'``, ``'no_multi_line'``): forbid
  510. multi-line whitespace or move the semicolon to the new line for chained
  511. calls; defaults to ``'no_multi_line'``
  512. * **native_function_casing** [@Symfony]
  513. Function defined by PHP should be called using the correct casing.
  514. * **native_function_invocation**
  515. Add leading ``\`` before function invocation to speed up resolving.
  516. *Risky rule: risky when any of the functions are overridden.*
  517. Configuration options:
  518. - ``exclude`` (``array``): list of functions to ignore; defaults to ``[]``
  519. - ``include`` (``array``): list of function names or sets to fix. Defined sets are
  520. ``@internal`` (all native functions), ``@all`` (all global functions) and
  521. ``@compiler_optimized`` (functions that are specially optimized by Zend);
  522. defaults to ``['@internal']``
  523. - ``scope`` (``'all'``, ``'namespaced'``): only fix function calls that are made
  524. within a namespace or fix all; defaults to ``'all'``
  525. * **new_with_braces** [@Symfony]
  526. All instances created with new keyword must be followed by braces.
  527. * **no_alias_functions** [@Symfony:risky]
  528. Master functions shall be used instead of aliases.
  529. *Risky rule: risky when any of the alias functions are overridden.*
  530. * **no_alternative_syntax**
  531. Replace control structure alternative syntax to use braces.
  532. * **no_binary_string**
  533. There should not be a binary flag before strings.
  534. * **no_blank_lines_after_class_opening** [@Symfony]
  535. There should be no empty lines after class opening brace.
  536. * **no_blank_lines_after_phpdoc** [@Symfony]
  537. There should not be blank lines between docblock and the documented
  538. element.
  539. * **no_blank_lines_before_namespace**
  540. There should be no blank lines before a namespace declaration.
  541. * **no_break_comment** [@PSR2, @Symfony]
  542. There must be a comment when fall-through is intentional in a non-empty
  543. case body.
  544. Configuration options:
  545. - ``comment_text`` (``string``): the text to use in the added comment and to
  546. detect it; defaults to ``'no break'``
  547. * **no_closing_tag** [@PSR2, @Symfony]
  548. The closing ``?>`` tag MUST be omitted from files containing only PHP.
  549. * **no_empty_comment** [@Symfony]
  550. There should not be any empty comments.
  551. * **no_empty_phpdoc** [@Symfony]
  552. There should not be empty PHPDoc blocks.
  553. * **no_empty_statement** [@Symfony]
  554. Remove useless semicolon statements.
  555. * **no_extra_blank_lines** [@Symfony]
  556. Removes extra blank lines and/or blank lines following configuration.
  557. Configuration options:
  558. - ``tokens`` (a subset of ``['break', 'case', 'continue', 'curly_brace_block',
  559. 'default', 'extra', 'parenthesis_brace_block', 'return',
  560. 'square_brace_block', 'switch', 'throw', 'use', 'use_trait']``): list of
  561. tokens to fix; defaults to ``['extra']``
  562. * **no_homoglyph_names** [@Symfony:risky]
  563. Replace accidental usage of homoglyphs (non ascii characters) in names.
  564. *Risky rule: renames classes and cannot rename the files. You might have string references to renamed code (``$$name``).*
  565. * **no_leading_import_slash** [@Symfony]
  566. Remove leading slashes in ``use`` clauses.
  567. * **no_leading_namespace_whitespace** [@Symfony]
  568. The namespace declaration line shouldn't contain leading whitespace.
  569. * **no_mixed_echo_print** [@Symfony]
  570. Either language construct ``print`` or ``echo`` should be used.
  571. Configuration options:
  572. - ``use`` (``'echo'``, ``'print'``): the desired language construct; defaults to
  573. ``'echo'``
  574. * **no_multiline_whitespace_around_double_arrow** [@Symfony]
  575. Operator ``=>`` should not be surrounded by multi-line whitespaces.
  576. * **no_null_property_initialization**
  577. Properties MUST not be explicitly initialized with ``null``.
  578. * **no_php4_constructor**
  579. Convert PHP4-style constructors to ``__construct``.
  580. *Risky rule: risky when old style constructor being fixed is overridden or overrides parent one.*
  581. * **no_short_bool_cast** [@Symfony]
  582. Short cast ``bool`` using double exclamation mark should not be used.
  583. * **no_short_echo_tag**
  584. Replace short-echo ``<?=`` with long format ``<?php echo`` syntax.
  585. * **no_singleline_whitespace_before_semicolons** [@Symfony]
  586. Single-line whitespace before closing semicolon are prohibited.
  587. * **no_spaces_after_function_name** [@PSR2, @Symfony]
  588. When making a method or function call, there MUST NOT be a space between
  589. the method or function name and the opening parenthesis.
  590. * **no_spaces_around_offset** [@Symfony]
  591. There MUST NOT be spaces around offset braces.
  592. Configuration options:
  593. - ``positions`` (a subset of ``['inside', 'outside']``): whether spacing should be
  594. fixed inside and/or outside the offset braces; defaults to ``['inside',
  595. 'outside']``
  596. * **no_spaces_inside_parenthesis** [@PSR2, @Symfony]
  597. There MUST NOT be a space after the opening parenthesis. There MUST NOT
  598. be a space before the closing parenthesis.
  599. * **no_superfluous_elseif**
  600. Replaces superfluous ``elseif`` with ``if``.
  601. * **no_superfluous_phpdoc_tags**
  602. Removes ``@param`` and ``@return`` tags that don't provide any useful
  603. information.
  604. * **no_trailing_comma_in_list_call** [@Symfony]
  605. Remove trailing commas in list function calls.
  606. * **no_trailing_comma_in_singleline_array** [@Symfony]
  607. PHP single-line arrays should not have trailing comma.
  608. * **no_trailing_whitespace** [@PSR2, @Symfony]
  609. Remove trailing whitespace at the end of non-blank lines.
  610. * **no_trailing_whitespace_in_comment** [@PSR2, @Symfony]
  611. There MUST be no trailing spaces inside comment or PHPDoc.
  612. * **no_unneeded_control_parentheses** [@Symfony]
  613. Removes unneeded parentheses around control statements.
  614. Configuration options:
  615. - ``statements`` (``array``): list of control statements to fix; defaults to
  616. ``['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case',
  617. 'yield']``
  618. * **no_unneeded_curly_braces** [@Symfony]
  619. Removes unneeded curly braces that are superfluous and aren't part of a
  620. control structure's body.
  621. * **no_unneeded_final_method** [@Symfony]
  622. A final class must not have final methods.
  623. * **no_unreachable_default_argument_value**
  624. In function arguments there must not be arguments with default values
  625. before non-default ones.
  626. *Risky rule: modifies the signature of functions; therefore risky when using systems (such as some Symfony components) that rely on those (for example through reflection).*
  627. * **no_unset_on_property**
  628. Properties should be set to ``null`` instead of using ``unset``.
  629. *Risky rule: changing variables to ``null`` instead of unsetting them will mean they still show up when looping over class variables.*
  630. * **no_unused_imports** [@Symfony]
  631. Unused ``use`` statements must be removed.
  632. * **no_useless_else**
  633. There should not be useless ``else`` cases.
  634. * **no_useless_return**
  635. There should not be an empty ``return`` statement at the end of a
  636. function.
  637. * **no_whitespace_before_comma_in_array** [@Symfony]
  638. In array declaration, there MUST NOT be a whitespace before each comma.
  639. * **no_whitespace_in_blank_line** [@Symfony]
  640. Remove trailing whitespace at the end of blank lines.
  641. * **non_printable_character** [@Symfony:risky, @PHP70Migration:risky, @PHP71Migration:risky]
  642. Remove Zero-width space (ZWSP), Non-breaking space (NBSP) and other
  643. invisible unicode symbols.
  644. *Risky rule: risky when strings contain intended invisible characters.*
  645. Configuration options:
  646. - ``use_escape_sequences_in_strings`` (``bool``): whether characters should be
  647. replaced with escape sequences in strings; defaults to ``false``
  648. * **normalize_index_brace** [@Symfony]
  649. Array index should always be written by using square braces.
  650. * **not_operator_with_space**
  651. Logical NOT operators (``!``) should have leading and trailing
  652. whitespaces.
  653. * **not_operator_with_successor_space**
  654. Logical NOT operators (``!``) should have one trailing whitespace.
  655. * **object_operator_without_whitespace** [@Symfony]
  656. There should not be space before or after object ``T_OBJECT_OPERATOR``
  657. ``->``.
  658. * **ordered_class_elements**
  659. Orders the elements of classes/interfaces/traits.
  660. Configuration options:
  661. - ``order`` (a subset of ``['use_trait', 'public', 'protected', 'private',
  662. 'constant', 'constant_public', 'constant_protected',
  663. 'constant_private', 'property', 'property_static', 'property_public',
  664. 'property_protected', 'property_private', 'property_public_static',
  665. 'property_protected_static', 'property_private_static', 'method',
  666. 'method_static', 'method_public', 'method_protected', 'method_private',
  667. 'method_public_static', 'method_protected_static',
  668. 'method_private_static', 'construct', 'destruct', 'magic', 'phpunit']``):
  669. list of strings defining order of elements; defaults to ``['use_trait',
  670. 'constant_public', 'constant_protected', 'constant_private',
  671. 'property_public', 'property_protected', 'property_private',
  672. 'construct', 'destruct', 'magic', 'phpunit', 'method_public',
  673. 'method_protected', 'method_private']``
  674. - ``sortAlgorithm`` (``'alpha'``, ``'none'``): how multiple occurrences of same type
  675. statements should be sorted; defaults to ``'none'``
  676. * **ordered_imports**
  677. Ordering ``use`` statements.
  678. Configuration options:
  679. - ``imports_order`` (``array``, ``null``): defines the order of import types; defaults
  680. to ``null``; DEPRECATED alias: ``importsOrder``
  681. - ``sort_algorithm`` (``'alpha'``, ``'length'``, ``'none'``): whether the statements
  682. should be sorted alphabetically or by length, or not sorted; defaults
  683. to ``'alpha'``; DEPRECATED alias: ``sortAlgorithm``
  684. * **php_unit_construct** [@Symfony:risky]
  685. PHPUnit assertion method calls like ``->assertSame(true, $foo)`` should be
  686. written with dedicated method like ``->assertTrue($foo)``.
  687. *Risky rule: fixer could be risky if one is overriding PHPUnit's native methods.*
  688. Configuration options:
  689. - ``assertions`` (a subset of ``['assertSame', 'assertEquals',
  690. 'assertNotEquals', 'assertNotSame']``): list of assertion methods to fix;
  691. defaults to ``['assertEquals', 'assertSame', 'assertNotEquals',
  692. 'assertNotSame']``
  693. * **php_unit_dedicate_assert** [@PHPUnit30Migration:risky, @PHPUnit32Migration:risky, @PHPUnit35Migration:risky, @PHPUnit43Migration:risky, @PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
  694. PHPUnit assertions like ``assertInternalType``, ``assertFileExists``, should
  695. be used over ``assertTrue``.
  696. *Risky rule: fixer could be risky if one is overriding PHPUnit's native methods.*
  697. Configuration options:
  698. - ``target`` (``'3.0'``, ``'3.5'``, ``'5.0'``, ``'5.6'``, ``'newest'``): target version of
  699. PHPUnit; defaults to ``'newest'``
  700. * **php_unit_expectation** [@PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
  701. Usages of ``->setExpectedException*`` methods MUST be replaced by
  702. ``->expectException*`` methods.
  703. *Risky rule: risky when PHPUnit classes are overridden or not accessible, or when project has PHPUnit incompatibilities.*
  704. Configuration options:
  705. - ``target`` (``'5.2'``, ``'5.6'``, ``'newest'``): target version of PHPUnit; defaults to
  706. ``'newest'``
  707. * **php_unit_fqcn_annotation** [@Symfony]
  708. PHPUnit annotations should be a FQCNs including a root namespace.
  709. * **php_unit_internal_class**
  710. All PHPUnit test classes should be marked as internal.
  711. Configuration options:
  712. - ``types`` (a subset of ``['normal', 'final', 'abstract']``): what types of
  713. classes to mark as internal; defaults to ``['normal', 'final']``
  714. * **php_unit_mock** [@PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
  715. Usages of ``->getMock`` and
  716. ``->getMockWithoutInvokingTheOriginalConstructor`` methods MUST be
  717. replaced by ``->createMock`` or ``->createPartialMock`` methods.
  718. *Risky rule: risky when PHPUnit classes are overridden or not accessible, or when project has PHPUnit incompatibilities.*
  719. Configuration options:
  720. - ``target`` (``'5.4'``, ``'5.5'``, ``'newest'``): target version of PHPUnit; defaults to
  721. ``'newest'``
  722. * **php_unit_namespaced** [@PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
  723. PHPUnit classes MUST be used in namespaced version, eg
  724. ``\PHPUnit\Framework\TestCase`` instead of ``\PHPUnit_Framework_TestCase``.
  725. *Risky rule: risky when PHPUnit classes are overridden or not accessible, or when project has PHPUnit incompatibilities.*
  726. Configuration options:
  727. - ``target`` (``'4.8'``, ``'5.7'``, ``'6.0'``, ``'newest'``): target version of PHPUnit;
  728. defaults to ``'newest'``
  729. * **php_unit_no_expectation_annotation** [@PHPUnit32Migration:risky, @PHPUnit35Migration:risky, @PHPUnit43Migration:risky, @PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky]
  730. Usages of ``@expectedException*`` annotations MUST be replaced by
  731. ``->setExpectedException*`` methods.
  732. *Risky rule: risky when PHPUnit classes are overridden or not accessible, or when project has PHPUnit incompatibilities.*
  733. Configuration options:
  734. - ``target`` (``'3.2'``, ``'4.3'``, ``'newest'``): target version of PHPUnit; defaults to
  735. ``'newest'``
  736. - ``use_class_const`` (``bool``): use ::class notation; defaults to ``true``
  737. * **php_unit_ordered_covers**
  738. Order ``@covers`` annotation of PHPUnit tests.
  739. * **php_unit_set_up_tear_down_visibility**
  740. Changes the visibility of the ``setUp()`` and ``tearDown()`` functions of
  741. PHPUnit to ``protected``, to match the PHPUnit TestCase.
  742. *Risky rule: this fixer may change functions named ``setUp()`` or ``tearDown()`` outside of PHPUnit tests, when a class is wrongly seen as a PHPUnit test.*
  743. * **php_unit_strict**
  744. PHPUnit methods like ``assertSame`` should be used instead of
  745. ``assertEquals``.
  746. *Risky rule: risky when any of the functions are overridden or when testing object equality.*
  747. Configuration options:
  748. - ``assertions`` (a subset of ``['assertAttributeEquals',
  749. 'assertAttributeNotEquals', 'assertEquals', 'assertNotEquals']``): list
  750. of assertion methods to fix; defaults to ``['assertAttributeEquals',
  751. 'assertAttributeNotEquals', 'assertEquals', 'assertNotEquals']``
  752. * **php_unit_test_annotation**
  753. Adds or removes @test annotations from tests, following configuration.
  754. *Risky rule: this fixer may change the name of your tests, and could cause incompatibility with abstract classes or interfaces.*
  755. Configuration options:
  756. - ``case`` (``'camel'``, ``'snake'``): whether to camel or snake case when adding the
  757. test prefix; defaults to ``'camel'``
  758. - ``style`` (``'annotation'``, ``'prefix'``): whether to use the @test annotation or
  759. not; defaults to ``'prefix'``
  760. * **php_unit_test_case_static_method_calls**
  761. Calls to ``PHPUnit\Framework\TestCase`` static methods must all be of the
  762. same type, either ``$this->``, ``self::`` or ``static::``.
  763. *Risky rule: risky when PHPUnit methods are overridden or not accessible, or when project has PHPUnit incompatibilities.*
  764. Configuration options:
  765. - ``call_type`` (``'self'``, ``'static'``, ``'this'``): the call type to use for referring
  766. to PHPUnit methods; defaults to ``'static'``
  767. - ``methods`` (``array``): dictionary of ``method`` => ``call_type`` values that
  768. differ from the default strategy; defaults to ``[]``
  769. * **php_unit_test_class_requires_covers**
  770. Adds a default ``@coversNothing`` annotation to PHPUnit test classes that
  771. have no ``@covers*`` annotation.
  772. * **phpdoc_add_missing_param_annotation**
  773. PHPDoc should contain ``@param`` for all params.
  774. Configuration options:
  775. - ``only_untyped`` (``bool``): whether to add missing ``@param`` annotations for
  776. untyped parameters only; defaults to ``true``
  777. * **phpdoc_align** [@Symfony]
  778. All items of the given phpdoc tags must be either left-aligned or (by
  779. default) aligned vertically.
  780. Configuration options:
  781. - ``align`` (``'left'``, ``'vertical'``): align comments; defaults to ``'vertical'``
  782. - ``tags`` (a subset of ``['param', 'property', 'return', 'throws', 'type',
  783. 'var', 'method']``): the tags that should be aligned; defaults to
  784. ``['method', 'param', 'property', 'return', 'throws', 'type', 'var']``
  785. * **phpdoc_annotation_without_dot** [@Symfony]
  786. PHPDoc annotation descriptions should not be a sentence.
  787. * **phpdoc_indent** [@Symfony]
  788. Docblocks should have the same indentation as the documented subject.
  789. * **phpdoc_inline_tag** [@Symfony]
  790. Fix PHPDoc inline tags, make ``@inheritdoc`` always inline.
  791. * **phpdoc_no_access** [@Symfony]
  792. ``@access`` annotations should be omitted from PHPDoc.
  793. * **phpdoc_no_alias_tag** [@Symfony]
  794. No alias PHPDoc tags should be used.
  795. Configuration options:
  796. - ``replacements`` (``array``): mapping between replaced annotations with new
  797. ones; defaults to ``['property-read' => 'property', 'property-write' =>
  798. 'property', 'type' => 'var', 'link' => 'see']``
  799. * **phpdoc_no_empty_return** [@Symfony]
  800. ``@return`` void and ``@return null`` annotations should be omitted from
  801. PHPDoc.
  802. * **phpdoc_no_package** [@Symfony]
  803. ``@package`` and ``@subpackage`` annotations should be omitted from PHPDoc.
  804. * **phpdoc_no_useless_inheritdoc** [@Symfony]
  805. Classy that does not inherit must not have ``@inheritdoc`` tags.
  806. * **phpdoc_order**
  807. Annotations in PHPDoc should be ordered so that ``@param`` annotations
  808. come first, then ``@throws`` annotations, then ``@return`` annotations.
  809. * **phpdoc_return_self_reference** [@Symfony]
  810. The type of ``@return`` annotations of methods returning a reference to
  811. itself must the configured one.
  812. Configuration options:
  813. - ``replacements`` (``array``): mapping between replaced return types with new
  814. ones; defaults to ``['this' => '$this', '@this' => '$this', '$self' =>
  815. 'self', '@self' => 'self', '$static' => 'static', '@static' =>
  816. 'static']``
  817. * **phpdoc_scalar** [@Symfony]
  818. Scalar types should always be written in the same form. ``int`` not
  819. ``integer``, ``bool`` not ``boolean``, ``float`` not ``real`` or ``double``.
  820. Configuration options:
  821. - ``types`` (a subset of ``['boolean', 'callback', 'double', 'integer', 'real',
  822. 'str']``): a map of types to fix; defaults to ``['boolean', 'double',
  823. 'integer', 'real', 'str']``
  824. * **phpdoc_separation** [@Symfony]
  825. Annotations in PHPDoc should be grouped together so that annotations of
  826. the same type immediately follow each other, and annotations of a
  827. different type are separated by a single blank line.
  828. * **phpdoc_single_line_var_spacing** [@Symfony]
  829. Single line ``@var`` PHPDoc should have proper spacing.
  830. * **phpdoc_summary** [@Symfony]
  831. PHPDoc summary should end in either a full stop, exclamation mark, or
  832. question mark.
  833. * **phpdoc_to_comment** [@Symfony]
  834. Docblocks should only be used on structural elements.
  835. * **phpdoc_to_return_type**
  836. EXPERIMENTAL: Takes ``@return`` annotation of non-mixed types and adjusts
  837. accordingly the function signature. Requires PHP >= 7.0.
  838. *Risky rule: [1] This rule is EXPERIMENTAL and is not covered with backward compatibility promise. [2] ``@return`` annotation is mandatory for the fixer to make changes, signatures of methods without it (no docblock, inheritdocs) will not be fixed. [3] Manual actions are required if inherited signatures are not properly documented. [4] ``@inheritdocs`` support is under construction.*
  839. Configuration options:
  840. - ``scalar_types`` (``bool``): fix also scalar types; may have unexpected
  841. behaviour due to PHP bad type coercion system; defaults to ``true``
  842. * **phpdoc_trim** [@Symfony]
  843. PHPDoc should start and end with content, excluding the very first and
  844. last line of the docblocks.
  845. * **phpdoc_trim_consecutive_blank_line_separation**
  846. Removes extra blank lines after summary and after description in PHPDoc.
  847. * **phpdoc_types** [@Symfony]
  848. The correct case must be used for standard PHP types in PHPDoc.
  849. * **phpdoc_types_order**
  850. Sorts PHPDoc types.
  851. Configuration options:
  852. - ``null_adjustment`` (``'always_first'``, ``'always_last'``, ``'none'``): forces the
  853. position of ``null`` (overrides ``sort_algorithm``); defaults to
  854. ``'always_first'``
  855. - ``sort_algorithm`` (``'alpha'``, ``'none'``): the sorting algorithm to apply;
  856. defaults to ``'alpha'``
  857. * **phpdoc_var_without_name** [@Symfony]
  858. ``@var`` and ``@type`` annotations should not contain the variable name.
  859. * **pow_to_exponentiation** [@PHP56Migration:risky, @PHP70Migration:risky, @PHP71Migration:risky]
  860. Converts ``pow`` to the ``**`` operator.
  861. *Risky rule: risky when the function ``pow`` is overridden.*
  862. * **protected_to_private** [@Symfony]
  863. Converts ``protected`` variables and methods to ``private`` where possible.
  864. * **psr0**
  865. Classes must be in a path that matches their namespace, be at least one
  866. namespace deep and the class name should match the file name.
  867. *Risky rule: this fixer may change your class name, which will break the code that is depended on old name.*
  868. Configuration options:
  869. - ``dir`` (``string``): the directory where the project code is placed; defaults
  870. to ``''``
  871. * **psr4** [@Symfony:risky]
  872. Class names should match the file name.
  873. *Risky rule: this fixer may change your class name, which will break the code that is depended on old name.*
  874. * **random_api_migration** [@PHP70Migration:risky, @PHP71Migration:risky]
  875. Replaces ``rand``, ``srand``, ``getrandmax`` functions calls with their ``mt_*``
  876. analogs.
  877. *Risky rule: risky when the configured functions are overridden.*
  878. Configuration options:
  879. - ``replacements`` (``array``): mapping between replaced functions with the new
  880. ones; defaults to ``['getrandmax' => 'mt_getrandmax', 'rand' =>
  881. 'mt_rand', 'srand' => 'mt_srand']``
  882. * **return_assignment**
  883. Local, dynamic and directly referenced variables should not be assigned
  884. and directly returned by a function or method.
  885. * **return_type_declaration** [@Symfony]
  886. There should be one or no space before colon, and one space after it in
  887. return type declarations, according to configuration.
  888. Configuration options:
  889. - ``space_before`` (``'none'``, ``'one'``): spacing to apply before colon; defaults to
  890. ``'none'``
  891. * **self_accessor** [@Symfony:risky]
  892. Inside class or interface element ``self`` should be preferred to the
  893. class name itself.
  894. *Risky rule: risky when using dynamic calls like get_called_class() or late static binding.*
  895. * **semicolon_after_instruction** [@Symfony]
  896. Instructions must be terminated with a semicolon.
  897. * **set_type_to_cast**
  898. Cast shall be used, not ``settype``.
  899. *Risky rule: risky when the ``settype`` function is overridden or when used as the 2nd or 3rd expression in a ``for`` loop .*
  900. * **short_scalar_cast** [@Symfony]
  901. Cast ``(boolean)`` and ``(integer)`` should be written as ``(bool)`` and
  902. ``(int)``, ``(double)`` and ``(real)`` as ``(float)``, ``(binary)`` as
  903. ``(string)``.
  904. * **silenced_deprecation_error**
  905. Ensures deprecation notices are silenced. DEPRECATED: use
  906. ``error_suppression`` instead.
  907. *Risky rule: silencing of deprecation errors might cause changes to code behaviour.*
  908. * **simplified_null_return**
  909. A return statement wishing to return ``void`` should not return ``null``.
  910. * **single_blank_line_at_eof** [@PSR2, @Symfony]
  911. A PHP file without end tag must always end with a single empty line
  912. feed.
  913. * **single_blank_line_before_namespace** [@Symfony]
  914. There should be exactly one blank line before a namespace declaration.
  915. * **single_class_element_per_statement** [@PSR2, @Symfony]
  916. There MUST NOT be more than one property or constant declared per
  917. statement.
  918. Configuration options:
  919. - ``elements`` (a subset of ``['const', 'property']``): list of strings which
  920. element should be modified; defaults to ``['const', 'property']``
  921. * **single_import_per_statement** [@PSR2, @Symfony]
  922. There MUST be one use keyword per declaration.
  923. * **single_line_after_imports** [@PSR2, @Symfony]
  924. Each namespace use MUST go on its own line and there MUST be one blank
  925. line after the use statements block.
  926. * **single_line_comment_style** [@Symfony]
  927. Single-line comments and multi-line comments with only one line of
  928. actual content should use the ``//`` syntax.
  929. Configuration options:
  930. - ``comment_types`` (a subset of ``['asterisk', 'hash']``): list of comment types
  931. to fix; defaults to ``['asterisk', 'hash']``
  932. * **single_quote** [@Symfony]
  933. Convert double quotes to single quotes for simple strings.
  934. Configuration options:
  935. - ``strings_containing_single_quote_chars`` (``bool``): whether to fix
  936. double-quoted strings that contains single-quotes; defaults to ``false``
  937. * **space_after_semicolon** [@Symfony]
  938. Fix whitespace after a semicolon.
  939. Configuration options:
  940. - ``remove_in_empty_for_expressions`` (``bool``): whether spaces should be removed
  941. for empty ``for`` expressions; defaults to ``false``
  942. * **standardize_increment** [@Symfony]
  943. Increment and decrement operators should be used if possible.
  944. * **standardize_not_equals** [@Symfony]
  945. Replace all ``<>`` with ``!=``.
  946. * **static_lambda**
  947. Lambdas not (indirect) referencing ``$this`` must be declared ``static``.
  948. *Risky rule: risky when using "->bindTo" on lambdas without referencing to ``$this``.*
  949. * **strict_comparison**
  950. Comparisons should be strict.
  951. *Risky rule: changing comparisons to strict might change code behavior.*
  952. * **strict_param**
  953. Functions should be used with ``$strict`` param set to ``true``.
  954. *Risky rule: risky when the fixed function is overridden or if the code relies on non-strict usage.*
  955. * **string_line_ending**
  956. All multi-line strings must use correct line ending.
  957. *Risky rule: changing the line endings of multi-line strings might affect string comparisons and outputs.*
  958. * **switch_case_semicolon_to_colon** [@PSR2, @Symfony]
  959. A case should be followed by a colon and not a semicolon.
  960. * **switch_case_space** [@PSR2, @Symfony]
  961. Removes extra spaces between colon and case value.
  962. * **ternary_operator_spaces** [@Symfony]
  963. Standardize spaces around ternary operator.
  964. * **ternary_to_null_coalescing** [@PHP70Migration, @PHP71Migration]
  965. Use ``null`` coalescing operator ``??`` where possible. Requires PHP >= 7.0.
  966. * **trailing_comma_in_multiline_array** [@Symfony]
  967. PHP multi-line arrays should have a trailing comma.
  968. * **trim_array_spaces** [@Symfony]
  969. Arrays should be formatted like function/method arguments, without
  970. leading or trailing single line space.
  971. * **unary_operator_spaces** [@Symfony]
  972. Unary operators should be placed adjacent to their operands.
  973. * **visibility_required** [@PSR2, @Symfony, @PHP71Migration]
  974. Visibility MUST be declared on all properties and methods; ``abstract``
  975. and ``final`` MUST be declared before the visibility; ``static`` MUST be
  976. declared after the visibility.
  977. Configuration options:
  978. - ``elements`` (a subset of ``['property', 'method', 'const']``): the structural
  979. elements to fix (PHP >= 7.1 required for ``const``); defaults to
  980. ``['property', 'method']``
  981. * **void_return** [@PHP71Migration:risky]
  982. Add void return type to functions with missing or empty return
  983. statements, but priority is given to ``@return`` annotations. Requires
  984. PHP >= 7.1.
  985. *Risky rule: modifies the signature of functions.*
  986. * **whitespace_after_comma_in_array** [@Symfony]
  987. In array declaration, there MUST be a whitespace after each comma.
  988. * **yoda_style** [@Symfony]
  989. Write conditions in Yoda style (``true``), non-Yoda style (``false``) or
  990. ignore those conditions (``null``) based on configuration.
  991. Configuration options:
  992. - ``always_move_variable`` (``bool``): whether variables should always be on non
  993. assignable side when applying Yoda style; defaults to ``false``
  994. - ``equal`` (``bool``, ``null``): style for equal (``==``, ``!=``) statements; defaults to
  995. ``true``
  996. - ``identical`` (``bool``, ``null``): style for identical (``===``, ``!==``) statements;
  997. defaults to ``true``
  998. - ``less_and_greater`` (``bool``, ``null``): style for less and greater than (``<``,
  999. ``<=``, ``>``, ``>=``) statements; defaults to ``null``
  1000. The ``--dry-run`` option displays the files that need to be
  1001. fixed but without actually modifying them:
  1002. .. code-block:: bash
  1003. $ php php-cs-fixer.phar fix /path/to/code --dry-run
  1004. Config file
  1005. -----------
  1006. Instead of using command line options to customize the rule, you can save the
  1007. project configuration in a ``.php_cs.dist`` file in the root directory of your project.
  1008. The file must return an instance of `PhpCsFixer\\ConfigInterface <https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v2.11.1/src/ConfigInterface.php>`_
  1009. which lets you configure the rules, the files and directories that
  1010. need to be analyzed. You may also create ``.php_cs`` file, which is
  1011. the local configuration that will be used instead of the project configuration. It
  1012. is a good practice to add that file into your ``.gitignore`` file.
  1013. With the ``--config`` option you can specify the path to the
  1014. ``.php_cs`` file.
  1015. The example below will add two rules to the default list of PSR2 set rules:
  1016. .. code-block:: php
  1017. <?php
  1018. $finder = PhpCsFixer\Finder::create()
  1019. ->exclude('somedir')
  1020. ->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php')
  1021. ->in(__DIR__)
  1022. ;
  1023. return PhpCsFixer\Config::create()
  1024. ->setRules([
  1025. '@PSR2' => true,
  1026. 'strict_param' => true,
  1027. 'array_syntax' => ['syntax' => 'short'],
  1028. ])
  1029. ->setFinder($finder)
  1030. ;
  1031. **NOTE**: ``exclude`` will work only for directories, so if you need to exclude file, try ``notPath``.
  1032. See `Symfony\\Finder <https://symfony.com/doc/current/components/finder.html>`_
  1033. online documentation for other `Finder` methods.
  1034. You may also use a blacklist for the rules instead of the above shown whitelist approach.
  1035. The following example shows how to use all ``Symfony`` rules but the ``full_opening_tag`` rule.
  1036. .. code-block:: php
  1037. <?php
  1038. $finder = PhpCsFixer\Finder::create()
  1039. ->exclude('somedir')
  1040. ->in(__DIR__)
  1041. ;
  1042. return PhpCsFixer\Config::create()
  1043. ->setRules([
  1044. '@Symfony' => true,
  1045. 'full_opening_tag' => false,
  1046. ])
  1047. ->setFinder($finder)
  1048. ;
  1049. You may want to use non-linux whitespaces in your project. Then you need to
  1050. configure them in your config file.
  1051. .. code-block:: php
  1052. <?php
  1053. return PhpCsFixer\Config::create()
  1054. ->setIndent("\t")
  1055. ->setLineEnding("\r\n")
  1056. ;
  1057. By using ``--using-cache`` option with ``yes`` or ``no`` you can set if the caching
  1058. mechanism should be used.
  1059. Caching
  1060. -------
  1061. The caching mechanism is enabled by default. This will speed up further runs by
  1062. fixing only files that were modified since the last run. The tool will fix all
  1063. files if the tool version has changed or the list of rules has changed.
  1064. Cache is supported only for tool downloaded as phar file or installed via
  1065. composer.
  1066. Cache can be disabled via ``--using-cache`` option or config file:
  1067. .. code-block:: php
  1068. <?php
  1069. return PhpCsFixer\Config::create()
  1070. ->setUsingCache(false)
  1071. ;
  1072. Cache file can be specified via ``--cache-file`` option or config file:
  1073. .. code-block:: php
  1074. <?php
  1075. return PhpCsFixer\Config::create()
  1076. ->setCacheFile(__DIR__.'/.php_cs.cache')
  1077. ;
  1078. Using PHP CS Fixer on CI
  1079. ------------------------
  1080. Require ``friendsofphp/php-cs-fixer`` as a ``dev`` dependency:
  1081. .. code-block:: bash
  1082. $ ./composer.phar require --dev friendsofphp/php-cs-fixer
  1083. Then, add the following command to your CI:
  1084. .. code-block:: bash
  1085. $ IFS='
  1086. $ '
  1087. $ CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "${COMMIT_RANGE}")
  1088. $ if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php_cs(\\.dist)?|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi
  1089. $ vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --stop-on-violation --using-cache=no ${EXTRA_ARGS}
  1090. Where ``$COMMIT_RANGE`` is your range of commits, eg ``$TRAVIS_COMMIT_RANGE`` or ``HEAD~..HEAD``.
  1091. Exit codes
  1092. ----------
  1093. Exit code is built using following bit flags:
  1094. * 0 OK.
  1095. * 1 General error (or PHP minimal requirement not matched).
  1096. * 4 Some files have invalid syntax (only in dry-run mode).
  1097. * 8 Some files need fixing (only in dry-run mode).
  1098. * 16 Configuration error of the application.
  1099. * 32 Configuration error of a Fixer.
  1100. * 64 Exception raised within the application.
  1101. (applies to exit codes of the `fix` command only)
  1102. Helpers
  1103. -------
  1104. Dedicated plugins exist for:
  1105. * `Atom`_
  1106. * `NetBeans`_
  1107. * `PhpStorm`_
  1108. * `Sublime Text`_
  1109. * `Vim`_
  1110. Contribute
  1111. ----------
  1112. The tool comes with quite a few built-in fixers, but everyone is more than
  1113. welcome to `contribute`_ more of them.
  1114. Fixers
  1115. ~~~~~~
  1116. A *fixer* is a class that tries to fix one CS issue (a ``Fixer`` class must
  1117. implement ``FixerInterface``).
  1118. Configs
  1119. ~~~~~~~
  1120. A *config* knows about the CS rules and the files and directories that must be
  1121. scanned by the tool when run in the directory of your project. It is useful for
  1122. projects that follow a well-known directory structures (like for Symfony
  1123. projects for instance).
  1124. .. _php-cs-fixer.phar: https://cs.sensiolabs.org/download/php-cs-fixer-v2.phar
  1125. .. _Atom: https://github.com/Glavin001/atom-beautify
  1126. .. _NetBeans: http://plugins.netbeans.org/plugin/49042/php-cs-fixer
  1127. .. _PhpStorm: https://medium.com/@valeryan/how-to-configure-phpstorm-to-use-php-cs-fixer-1844991e521f
  1128. .. _Sublime Text: https://github.com/benmatselby/sublime-phpcs
  1129. .. _Vim: https://github.com/stephpy/vim-php-cs-fixer
  1130. .. _contribute: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/CONTRIBUTING.md