-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php_cs
1856 lines (1643 loc) · 67.2 KB
/
.php_cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* Config file for PHP CS Fixer.
*
* @package Config - PHP CS Fixer
*
* @author Nick Menke <nick@nlmenke.net>
* @copyright 2018-2020 Nick Menke
*
* @link https://github.com/nlmenke/vertebrae
* @since x.x.x introduced
*/
/**
* Rules to be implemented by PHP CS Fixer.
*
* @see https://mlocati.github.io/php-cs-fixer-configurator/#version:2.15
*/
$rules = [
/**
* Each line of multi-line DocComments must have an asterisk [PSR-5] and must be aligned with the first one.
*
* @property string comment_type Whether to fix PHPDoc comments only (`phpdocs_only`), any multi-line comment whose
* lines all start with an asterisk (`phpdocs_like`) or any multi-line comment
* (`all_multiline`);
* default: 'phpdocs_only'
*/
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
],
/**
* Each element of an array must be indented exactly once.
*/
'array_indentation' => true,
/**
* PHP arrays should be declared using the configured syntax.
*
* @property string syntax Whether to use the `long` or `short` array syntax;
* default: 'long'
*/
'array_syntax' => [
'syntax' => 'short',
],
/**
* Converts backtick operators to `shell_exec` calls.
*/
'backtick_to_shell_exec' => false,
/**
* Binary operators should be surrounded by space as configured.
*
* @property bool align_double_arrow Whether to apply, remove or ignore double arrows alignment;
* default: false
* @property bool align_equals Whether to apply, remove or ignore equals alignment;
* default: false
*/
'binary_operator_spaces' => [
'align_double_arrow' => false,
'align_equals' => false,
],
/**
* There MUST be one blank line after the namespace declaration.
*/
'blank_line_after_namespace' => true,
/**
* Ensure there is no code on the same line as the PHP open tag and it is followed by a blank line.
*/
'blank_line_after_opening_tag' => true,
/**
* An empty line feed should precede a return statement.
*
* @deprecated Use `blank_line_before_statement`
*/
'blank_line_before_return' => false,
/**
* An empty line feed must precede any configured statement.
*
* @property array statements List of statements which must be preceded by an empty line;
* default: ['break', 'continue', 'declare', 'return', 'throw', 'try']
*/
'blank_line_before_statement' => [
'statements' => [
'break',
'continue',
'declare',
'return',
'throw',
'try',
],
],
/**
* The body of each structure MUST be enclosed by braces. Braces should be properly placed. Body of braces should
* be properly indented.
*
* @property bool allow_single_line_closure Whether single line lambda notation should be
* allowed;
* default: false
* @property string position_after_anonymous_constructs Whether the opening brace should be placed on
* "next" or "same" line after anonymous constructs
* (anonymous classes and lambda functions);
* default: 'same'
* @property string position_after_control_structures Whether the opening brace should be placed on
* "next" or "same" line after control structures
* default: 'same'
* @property string position_after_functions_and_oop_constructs Whether the opening brace should be placed on
* "next" or "same" line after classy constructs
* (non-anonymous classes, interfaces, traits, methods
* and non-lambda functions)
* default: 'next'
*/
'braces' => [
'allow_single_line_closure' => false,
'position_after_anonymous_constructs' => 'same',
'position_after_control_structures' => 'same',
'position_after_functions_and_oop_constructs' => 'next',
],
/**
* A single space or none should be between cast and variable.
*
* @property string space Spacing to apply between cast and variable;
* default: 'single'
*/
'cast_spaces' => [
'space' => 'none',
],
/**
* Class, trait and interface elements must be separated with one blank line.
*
* @property array elements List of classy elements; 'const', 'method', 'property';
* default: ['const', 'method', 'property']
*/
'class_attributes_separation' => [
'elements' => [
'const',
'method',
'property',
],
],
/**
* Whitespace around the keywords of a class, trait or interface's definition should be one space.
*
* @property bool multi_line_extends_each_single_line Whether definitions should be multiline;
* default: false
* @property bool single_item_single_line Whether definitions should be single line when including a
* single item;
* default: false
* @property bool single_line Whether definitions should be single line;
* default: false
*/
'class_definition' => [
'multi_line_extends_each_single_line' => false,
'single_item_single_line' => false,
'single_line' => false,
],
/**
* Converts `::class` keywords to FQCN strings.
*/
'class_keyword_remove' => false,
/**
* Using `isset($var) &&` multiple times should be done in one call.
*/
'combine_consecutive_issets' => true,
/**
* Calling `unset` on multiple items should be done in one call.
*/
'combine_consecutive_unsets' => true,
/**
* Replace multiple nested calls of `dirname` by only one call with second `$level` parameter. Requires PHP >= 7.0.
*
* Risky when the function `dirname` is overridden.
*/
'combine_nested_dirname' => false,
/**
* Comments with annotation should be docblock when used on structural elements.
*
* Risky as new docblocks might mean more (e.g.: a Doctrine entity might have a new column in database).
*/
'comment_to_phpdoc' => true,
/**
* Remove extra spaces in a nullable typehint.
*/
'compact_nullable_typehint' => true,
/**
* Concatenation should be spaced according configuration.
*
* @property string spacing Spacing to apply around concatenation operator;
* default: 'none'
*/
'concat_space' => [
'spacing' => 'one',
],
/**
* Class `DateTimeImmutable` should be used instead of `DateTime`.
*
* Risky when the code relies on modifying `DateTime` objects or if any of the `date_create*` functions are
* overridden.
*/
'date_time_immutable' => true,
/**
* Equal sign in declare statement should be surrounded by spaces or not following configuration.
*
* @property string space Spacing to apply around the equal sign;
* default: 'none'
*/
'declare_equal_normalize' => [
'space' => 'none',
],
/**
* Force strict types declaration in all files. Requires PHP >= 7.0.
*
* Risky: forcing strict types will stop non strict code from working.
*/
'declare_strict_types' => true,
/**
* Replaces `dirname(__FILE__) expression with equivalent __DIR__ constant.
*
* Risky when the function dirname is overridden.
*/
'dir_constant' => true,
/**
* Doctrine annotations must use configured operator for assignment in arrays.
*
* @property array ignored_tags List of tags that must not be treated as Doctrine Annotations;
* default: ['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',
* 'fix', 'FIXME', 'fixme', 'override']
* @property string operator The operator to use;
* default: '='
*/
'doctrine_annotation_array_assignment' => false,
/**
* Doctrine annotations without arguments must use the configured syntax.
*
* @property array ignored_tags List of tags that must not be treated as Doctrine Annotations.
* default: ['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',
* 'fix', 'FIXME', 'fixme', 'override']
* @property string syntax Whether to add or remove braces;
* default: 'without_braces'
*/
'doctrine_annotation_braces' => false,
/**
* Doctrine annotations must be indented with four spaces.
*
* @property array ignored_tags List of tags that must not be treated as Doctrine Annotations.
* default: ['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',
* 'fix', 'FIXME', 'fixme', 'override']
* @property bool indent_mixed_lines Whether to indent lines that have content before closing parenthesis;
* default: false
*/
'doctrine_annotation_indentation' => false,
/**
* Fixes spaces in Doctrine annotations.
*
* @property bool after_argument_assignments Whether to add, remove or ignore spaces after argument assignment
* operator;
* default: false
* @property bool after_array_assignments_colon Whether to add, remove or ignore spaces after array assignment
* `:` operator;
* default: true
* @property bool after_array_assignments_equals Whether to add, remove or ignore spaces after array assignment
* `=` operator;
* default: true
* @property bool around_argument_assignments Whether to fix spaces around argument assignment operator;
* default: true
* @property bool around_array_assignments Whether to fix spaces around array assignment operators;
* default: true
* @property bool around_commas Whether to fix spaces around commas;
* default: true
* @property bool around_parentheses Whether to fix spaces around parentheses;
* default: true
* @property bool before_argument_assignments Whether to add, remove or ignore spaces before argument
* assignment operator;
* default: false
* @property bool before_array_assignments_colon Whether to add, remove or ignore spaces before array `:`
* assignment operator;
* default: true
* @property bool before_array_assignments_equals Whether to add, remove or ignore spaces before array `=`
* assignment operator;
* default: true
* @property array ignored_tags List of tags that must not be treated as Doctrine Annotations;
* default: ['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', 'fix', 'FIXME', 'fixme', 'override']
*/
'doctrine_annotation_spaces' => false,
/**
* The keyword `elseif` should be used instead of `else if` so that all control keywords look like single words.
*/
'elseif' => true,
/**
* PHP code MUST use only UTF-8 without BOM (remove BOM).
*/
'encoding' => true,
/**
* Replace deprecated `ereg` regular expression functions with `preg`.
*
* Risky if `ereg` function is overridden.
*/
'ereg_to_preg' => false,
/**
* Error control operator should be added to deprecation notices and/or removed from other cases.
*
* Risky because adding/removing `@` might cause changes to code behaviour or if `trigger_error` function is
* overridden.
*
* @property bool mute_deprecation_error Whether to add `@` in deprecation notices;
* default: true
* @property bool noise_remaining_usages Whether to remove `@` in remaining usages;
* default: false
* @property array noise_remaining_usages_exclude List of global functions to exclude from removing `@`;
* default: []
*/
'error_suppression' => false,
/**
* Escape implicit backslashes in strings and heredocs to ease the understanding of which are special chars
* interpreted by PHP and which not.
*
* @property bool double_quoted Whether to fix double-quoted strings;
* default: true
* @property bool heredoc_syntax Whether to fix heredoc syntax;
* default: true
* @property bool single_quoted Whether to fix single-quoted strings;
* default: false
*/
'escape_implicit_backslashes' => false,
/**
* Add curly braces to indirect variables to make them clear to understand. Requires PHP >= 7.0.
*/
'explicit_indirect_variable' => true,
/**
* Converts implicit variables into explicit ones in double-quoted strings or heredoc syntax.
*/
'explicit_string_variable' => true,
/**
* All classes must be final, except abstract ones and Doctrine entities.
*
* Risky when subclassing non-abstract classes.
*/
'final_class' => false,
/**
* Internal classes should be `final`.
*
* Risky: changing classes to `final` might cause code execution to break.
*
* @property array annotation-black-list Class level annotations tags that must be omitted to
* fix the class, even if all of the white list ones are
* used as well (case insensitive);
* default: ['@final', '@Entity', '@ORM\\Entity']
* @property array annotation-white-list Class level annotations tags that must be set in order
* to fix the class (case insensitive);
* default: ['@internal']
* @property bool consider-absent-docblock-as-internal-class Should classes without any DocBlock be fixed to final?
* default: false
*/
'final_internal_class' => false,
/**
* Order the flags in `fopen` calls, `b` and `t` must be last.
*
* Risky when the function `fopen` is overridden.
*/
'fopen_flag_order' => false,
/**
* The flags in `fopen` calls must omit `t`, and `b` must be omitted or included consistently.
*
* Risky when the function `fopen` is overridden.
*/
'fopen_flags' => false,
/**
* PHP code must use the long <?php tags or short-echo <?= tags and not other tag variations.
*/
'full_opening_tag' => true,
/**
* Transforms imported FQCN parameters and return types in function arguments to short version.
*/
'fully_qualified_strict_types' => true,
/**
* Spaces should be properly placed in a function declaration.
*
* @property string closure_function_spacing Spacing to use before open parenthesis for closures;
* default: 'one'
*/
'function_declaration' => [
'closure_function_spacing' => 'one',
],
/**
* Replace core functions calls returning constants with the constants.
*
* Risky when any of the configured functions to replace are overridden.
*
* @property array functions List of function names to fix;
* default: ['get_class', 'php_sapi_name', 'phpversion', 'pi']
*/
'function_to_constant' => false,
/**
* Ensure single space between function's argument and its typehint.
*/
'function_typehint_space' => true,
/**
* Configured annotations should be omitted from PHPDoc.
*
* @property array annotations List of annotations to remove (e.g.: ['author']);
* default: []
*/
'general_phpdoc_annotation_remove' => false,
/**
* Single line comments should use double slashes `//` and not hash `#`.
*
* @deprecated Use `single_line_comment_style`
*/
'hash_to_slash_comment' => false,
/**
* Add, replace or remove header comment.
*
* @property string comment_type Comment syntax type;
* default: 'comment'
* @property string header Proper header content;
* default: ''
* @property string location The location of the inserted header;
* default: 'after_declare_strict'
* @property string separate Whether the header should be separated from the file content with a new line;
* default: 'both'
*/
'header_comment' => false,
/**
* Heredoc/nowdoc content must be properly indented. Requires PHP >= 7.3.
*/
'heredoc_indentation' => false,
/**
* Convert `heredoc` to `nowdoc` where possible.
*/
'heredoc_to_nowdoc' => true,
/**
* Function `implode` must be called with 2 arguments in the documented order.
*
* Risky when the function `implode` is overridden.
*/
'implode_call' => true,
/**
* Include/Require and file path should be divided with a single space. File path should not be placed under
* brackets.
*/
'include' => true,
/**
* Pre- or post-increment and decrement operators should be used if possible.
*
* @property string style Whether to use pre- or post-increment and decrement operators;
* default: 'pre'
*/
'increment_style' => [
'style' => 'post',
],
/**
* Code MUST use configured indentation type.
*/
'indentation_type' => true,
/**
* Replaces `is_null($var)` expression with `null === $var`.
*
* Risky when the function `is_null` is overridden.
*/
'is_null' => [ //
'use_yoda_style' => false,
],
/**
* All PHP files must use same line ending.
*/
'line_ending' => true,
/**
* Ensure there is no code on the same line as the PHP open tag.
*/
'linebreak_after_opening_tag' => false,
/**
* List (`array` destructuring) assignment should be declared using the configured syntax. Requires PHP >= 7.1.
*
* @property string syntax Whether to use the `long` or `short list` syntax;
* default: 'long'
*/
'list_syntax' => [
'syntax' => 'long',
],
/**
* Use `&&` and `||` logical operators instead of `and` and `or`.
*
* Risky, because you must double-check if using and/or with lower precedence was intentional.
*/
'logical_operators' => true,
/**
* Cast should be written in lower case.
*/
'lowercase_cast' => true,
/**
* The PHP constants `true`, `false`, and `null` MUST be in lower case.
*/
'lowercase_constants' => true,
/**
* PHP keywords MUST be in lower case.
*/
'lowercase_keywords' => true,
/**
* Class static references `self`, `static` and `parent` MUST be in lower case.
*/
'lowercase_static_reference' => true,
/**
* Magic constants should be referred to using the correct casing.
*/
'magic_constant_casing' => true,
/**
* Magic method definitions and calls must be using the correct casing.
*/
'magic_method_casing' => true,
/**
* Replace non multibyte-safe functions with corresponding mb function.
*
* Risky when any of the functions are overridden.
*/
'mb_str_functions' => true,
/**
* In method arguments and method call, there MUST NOT be a space before each comma and there MUST be one space
* after each comma. Argument lists MAY be split across multiple lines, where each subsequent line is indented
* once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument
* per line.
*
* @property bool after_heredoc Whether the whitespace between heredoc end and comma should be
* removed;
* default: false
* @property bool ensure_fully_multiline Ensure every argument of a multiline argument list is on its
* own line;
* default: false
* @property bool keep_multiple_spaces_after_comma Whether keep multiple spaces after comma;
* default: false
* @property string on_multiline Defines how to handle function arguments lists that contain
* newlines;
* default: 'ignore'
*/
'method_argument_space' => [
'after_heredoc' => false,
'ensure_fully_multiline' => false,
'keep_multiple_spaces_after_comma' => false,
'on_multiline' => 'ensure_fully_multiline',
],
/**
* Method chaining MUST be properly indented. Method chaining with different levels of indentation is not
* supported.
*/
'method_chaining_indentation' => true,
/**
* Methods must be separated with one blank line.
*
* @deprecated Use `class_attributes_separation`
*/
'method_separation' => false,
/**
* Replaces `intval`, `floatval`, `doubleval`, `strval` and `boolval` function calls with according type casting
* operator.
*
* Risky if any of the functions `intval`, `floatval`, `doubleval`, `strval` or `boolval` are overridden.
*/
'modernize_types_casting' => true,
/**
* DocBlocks must start with two asterisks, multiline comments must start with a single asterisk, after the opening
* slash. Both must end with a single asterisk before the closing slash.
*/
'multiline_comment_opening_closing' => true,
/**
* Forbid multi-line whitespace before the closing semicolon or move the semicolon to the new line for chained
* calls.
*
* @property string strategy Forbid multi-line whitespace or more the semicolon to the new line for chained calls;
* default: 'no_multi_line'
*/
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
/**
* Add leading `\` before constant invocation of internal constant to speed up resolving. Constant name match is
* case-sensitive, except for `null`, `false` and `true`.
*
* Risky when any of the constants are namespaced or overridden.
*
* @property array exclude List of constants to ignore;
* default: ['null', 'false', 'true']
* @property bool fix_built_in Whether to fix constants returned by `get_defined_constants`. User constants are
* not accounted in this list and must be specified in the include one;
* default: true
* @property array include List additional constants to fix;
* default: []
* @property string scope Only fix constant invocations that are made within a namespace or fix all;
* default: 'all'
*/
'native_constant_invocation' => false,
/**
* Function defined by PHP should be called using the correct casing.
*/
'native_function_casing' => true,
/**
* Add leading `\` before function invocation to speed up resolving.
*
* Risky when any of the functions are overridden.
*/
'native_function_invocation' => false,
/**
* Native type hints for functions should use the correct case.
*/
'native_function_type_declaration_casing' => true,
/**
* All instances created with new keyword must be followed by braces.
*/
'new_with_braces' => true,
/**
* Master functions shall be used instead of aliases.
*
* Risky when any of the alias functions are overridden.
*
* @property array sets List of sets to fix. Defined sets are `@internal` (native functions), `@IMAP` (IMAP
* functions), `@mbreg` (from `ext-mbstring`) `@all` (all listed sets);
* default: ['@internal`, `@IMAP`]
*/
'no_alias_functions' => [
'sets' => [
'@internal',
'@IMAP',
],
],
/**
* Replace control structure alternative syntax to use braces.
*/
'no_alternative_syntax' => true,
/**
* There should not be a binary flag before strings.
*/
'no_binary_string' => true,
/**
* There should be no empty lines after class opening brace.
*/
'no_blank_lines_after_class_opening' => true,
/**
* There should not be blank lines between docblock and the documented element.
*/
'no_blank_lines_after_phpdoc' => true,
/**
* There should be no blank lines before a namespace declaration.
*/
'no_blank_lines_before_namespace' => false,
/**
* There must be a comment when fall-through is intentional in a non-empty case body.
*
* @property string comment_text The text to use in the added comment and to detect it;
* default: 'no break'
*/
'no_break_comment' => [
'comment_text' => 'no break',
],
/**
* The closing `?>` tag MUST be omitted from files containing only PHP.
*/
'no_closing_tag' => true,
/**
* There should not be any empty comments.
*/
'no_empty_comment' => true,
/**
* There should not be empty PHPDoc blocks.
*/
'no_empty_phpdoc' => true,
/**
* Remove useless semicolon statements.
*/
'no_empty_statement' => true,
/**
* Removes extra blank lines and/or blank lines following configuration.
*
* @property array tokens List of tokens to fix;
* default: ['extra']
*/
'no_extra_blank_lines' => [
'tokens' => [
'extra',
],
],
/**
* Removes extra blank lines and/or blank lines following configuration.
*
* @deprecated Use `no_extra_blank_lines`
*/
'no_extra_consecutive_blank_lines' => false,
/**
* Replace accidental usage of homoglyphs (non ascii characters) in names.
*
* Risky: renames classes and cannot rename the files; you might have string references to renamed code (`$$name`).
*/
'no_homoglyph_names' => true,
/**
* Remove leading slashes in `use` clauses.
*/
'no_leading_import_slash' => true,
/**
* The namespace declaration line shouldn't contain leading whitespace.
*/
'no_leading_namespace_whitespace' => true,
/**
* Either language construct `print` or `echo` should be used.
*
* @property string use The desired language construct;
* default: 'echo'
*/
'no_mixed_echo_print' => [
'use' => 'echo',
],
/**
* Operator `=>` should not be surrounded by multi-line whitespaces.
*/
'no_multiline_whitespace_around_double_arrow' => true,
/**
* Multi-line whitespace before closing semicolon are prohibited.
*
* @deprecated Use `multiline_whitespace_before_semicolons`
*/
'no_multiline_whitespace_before_semicolons' => false,
/**
* Properties MUST not be explicitly initialized with `null`.
*/
'no_null_property_initialization' => true,
/**
* Convert PHP4-style constructors to `__construct`.
*
* Risky when old style constructor being fixed is overridden or overrides parent.
*/
'no_php4_constructor' => true,
/**
* Short cast `bool` using double exclamation mark should not be used.
*/
'no_short_bool_cast' => true,
/**
* Replace short-echo `<?=` with long format `<?php echo` syntax.
*/
'no_short_echo_tag' => true,
/**
* Single-line whitespace before closing semicolon are prohibited.
*/
'no_singleline_whitespace_before_semicolons' => true,
/**
* When making a method or function call, there MUST NOT be a space between the method or function name and the
* opening parenthesis.
*/
'no_spaces_after_function_name' => true,
/**
* There MUST NOT be spaces around offset braces.
*
* @property array positions Whether spacing should be fixed inside and/or outside the offset braces;
* default: ['inside', 'outside']
*/
'no_spaces_around_offset' => [
'positions' => [
'inside',
'outside',
],
],
/**
* There MUST NOT be a space after the opening parenthesis. There MUST NOT be a space before the closing
* parenthesis.
*/
'no_spaces_inside_parenthesis' => true,
/**
* Replaces superfluous `elseif` with `if`.
*/
'no_superfluous_elseif' => true,
/**
* Removes `@param` and `@return` tags that don't provide any useful information.
*
* @property bool allow_mixed Whether type `mixed` without description is allowed (`true`) or considered
* superfluous (`false`);
* default: false
*/
'no_superfluous_phpdoc_tags' => false,
/**
* Remove trailing commas in list function calls.
*/
'no_trailing_comma_in_list_call' => true,
/**
* PHP single-line arrays should not have trailing comma.
*/
'no_trailing_comma_in_singleline_array' => true,
/**
* Remove trailing whitespace at the end of non-blank lines.
*/
'no_trailing_whitespace' => true,
/**
* There MUST be no trailing spaces inside comment or PHPDoc.
*/
'no_trailing_whitespace_in_comment' => true,
/**
* Removes unneeded parentheses around control statements.
*
* @property array statements List of control statements to fix;
* default: ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case',
* 'yield']
*/
'no_unneeded_control_parentheses' => [
'statements' => [
'break',
'clone',
'continue',
'echo_print',
'return',
'switch_case',
'yield',
],
],
/**
* Removes unneeded curly braces that are superfluous and aren't part of a control structure's body.
*/
'no_unneeded_curly_braces' => true,
/**
* A final class must not have final methods.
*/
'no_unneeded_final_method' => true,
/**
* In function arguments there must not be arguments with default values before non-default ones.
*
* Risky: modifies the signature of functions; therefore risky when using systems (such as some Symfony components)
* that rely on those (for example through reflection).
*/
'no_unreachable_default_argument_value' => false,
/**
* Variables must be set `null` instead of using `(unset)` casting.
*/
'no_unset_cast' => true,
/**
* Properties should be set to `null` instead of using `unset`.