• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CodeIgniter / coding-standard / 14799566463

02 May 2025 04:49PM UTC coverage: 100.0%. Remained the same
14799566463

push

github

paulbalandan
Prepare changelog for v1.8.5

684 of 684 relevant lines covered (100.0%)

12.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/CodeIgniter4.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter 4 framework.
7
 *
8
 * (c) 2021 CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace CodeIgniter\CodingStandard;
15

16
use Nexus\CsConfig\Ruleset\AbstractRuleset;
17

18
/**
19
 * Defines the ruleset used for the CodeIgniter4 organization.
20
 *
21
 * {@internal Use of this class is not covered by the backward compatibility promise for CodeIgniter4.}
22
 */
23
final class CodeIgniter4 extends AbstractRuleset
24
{
25
    public function __construct()
26
    {
27
        $this->name = 'CodeIgniter4 Coding Standards';
12✔
28

29
        $this->rules = [
12✔
30
            'align_multiline_comment'                  => ['comment_type' => 'phpdocs_only'],
12✔
31
            'array_indentation'                        => true,
12✔
32
            'array_push'                               => true,
12✔
33
            'array_syntax'                             => ['syntax' => 'short'],
12✔
34
            'assign_null_coalescing_to_coalesce_equal' => true,
12✔
35
            'attribute_empty_parentheses'              => false,
12✔
36
            'backtick_to_shell_exec'                   => true,
12✔
37
            'binary_operator_spaces'                   => [
12✔
38
                'default'   => 'single_space',
12✔
39
                'operators' => [
12✔
40
                    '='  => 'align_single_space_minimal',
12✔
41
                    '=>' => 'align_single_space_minimal',
12✔
42
                    '||' => 'align_single_space_minimal',
12✔
43
                    '.=' => 'align_single_space_minimal',
12✔
44
                ],
12✔
45
            ],
12✔
46
            'blank_line_after_namespace'   => true,
12✔
47
            'blank_line_after_opening_tag' => true,
12✔
48
            'blank_line_before_statement'  => [
12✔
49
                'statements' => [
12✔
50
                    'case',
12✔
51
                    'continue',
12✔
52
                    'declare',
12✔
53
                    'default',
12✔
54
                    'do',
12✔
55
                    'exit',
12✔
56
                    'for',
12✔
57
                    'foreach',
12✔
58
                    'goto',
12✔
59
                    'return',
12✔
60
                    'switch',
12✔
61
                    'throw',
12✔
62
                    'try',
12✔
63
                    'while',
12✔
64
                    'yield',
12✔
65
                    'yield_from',
12✔
66
                ],
12✔
67
            ],
12✔
68
            'blank_line_between_import_groups' => true,
12✔
69
            'blank_lines_before_namespace'     => [
12✔
70
                'min_line_breaks' => 2,
12✔
71
                'max_line_breaks' => 2,
12✔
72
            ],
12✔
73
            'braces_position' => [
12✔
74
                'control_structures_opening_brace'          => 'same_line',
12✔
75
                'functions_opening_brace'                   => 'next_line_unless_newline_at_signature_end',
12✔
76
                'anonymous_functions_opening_brace'         => 'same_line',
12✔
77
                'classes_opening_brace'                     => 'next_line_unless_newline_at_signature_end',
12✔
78
                'anonymous_classes_opening_brace'           => 'same_line',
12✔
79
                'allow_single_line_empty_anonymous_classes' => true,
12✔
80
                'allow_single_line_anonymous_functions'     => true,
12✔
81
            ],
12✔
82
            'cast_spaces'                 => ['space' => 'single'],
12✔
83
            'class_attributes_separation' => [
12✔
84
                'elements' => [
12✔
85
                    'const'        => 'none',
12✔
86
                    'property'     => 'none',
12✔
87
                    'method'       => 'one',
12✔
88
                    'trait_import' => 'none',
12✔
89
                ],
12✔
90
            ],
12✔
91
            'class_definition' => [
12✔
92
                'multi_line_extends_each_single_line' => true,
12✔
93
                'single_item_single_line'             => true,
12✔
94
                'single_line'                         => true,
12✔
95
                'space_before_parenthesis'            => true,
12✔
96
                'inline_constructor_arguments'        => true,
12✔
97
            ],
12✔
98
            'class_keyword'               => false,
12✔
99
            'class_reference_name_casing' => true,
12✔
100
            'clean_namespace'             => true,
12✔
101
            'combine_consecutive_issets'  => true,
12✔
102
            'combine_consecutive_unsets'  => true,
12✔
103
            'combine_nested_dirname'      => true,
12✔
104
            'comment_to_phpdoc'           => [
12✔
105
                'ignored_tags' => [
12✔
106
                    'todo',
12✔
107
                    'codeCoverageIgnore',
12✔
108
                    'codeCoverageIgnoreStart',
12✔
109
                    'codeCoverageIgnoreEnd',
12✔
110
                    'phpstan-ignore',
12✔
111
                    'phpstan-ignore-line',
12✔
112
                    'phpstan-ignore-next-line',
12✔
113
                ],
12✔
114
            ],
12✔
115
            'compact_nullable_type_declaration'       => true,
12✔
116
            'concat_space'                            => ['spacing' => 'one'],
12✔
117
            'constant_case'                           => ['case' => 'lower'],
12✔
118
            'control_structure_braces'                => true,
12✔
119
            'control_structure_continuation_position' => ['position' => 'same_line'],
12✔
120
            'date_time_create_from_format_call'       => true,
12✔
121
            'date_time_immutable'                     => false,
12✔
122
            'declare_equal_normalize'                 => ['space' => 'none'],
12✔
123
            'declare_parentheses'                     => true,
12✔
124
            'declare_strict_types'                    => false,
12✔
125
            'dir_constant'                            => true,
12✔
126
            'doctrine_annotation_array_assignment'    => false,
12✔
127
            'doctrine_annotation_braces'              => false,
12✔
128
            'doctrine_annotation_indentation'         => false,
12✔
129
            'doctrine_annotation_spaces'              => false,
12✔
130
            'echo_tag_syntax'                         => [
12✔
131
                'format'                         => 'short',
12✔
132
                'long_function'                  => 'echo',
12✔
133
                'shorten_simple_statements_only' => false,
12✔
134
            ],
12✔
135
            'elseif'               => true,
12✔
136
            'empty_loop_body'      => ['style' => 'braces'],
12✔
137
            'empty_loop_condition' => ['style' => 'while'],
12✔
138
            'encoding'             => true,
12✔
139
            'ereg_to_preg'         => true,
12✔
140
            'error_suppression'    => [
12✔
141
                'mute_deprecation_error'         => true,
12✔
142
                'noise_remaining_usages'         => false,
12✔
143
                'noise_remaining_usages_exclude' => [],
12✔
144
            ],
12✔
145
            'explicit_indirect_variable' => true,
12✔
146
            'explicit_string_variable'   => true,
12✔
147
            'final_class'                => false,
12✔
148
            'final_internal_class'       => [
12✔
149
                'exclude'                                    => ['no-final'],
12✔
150
                'include'                                    => ['internal'],
12✔
151
                'consider_absent_docblock_as_internal_class' => false,
12✔
152
            ],
12✔
153
            'final_public_method_for_abstract_class' => false,
12✔
154
            'fopen_flag_order'                       => true,
12✔
155
            'fopen_flags'                            => ['b_mode' => true],
12✔
156
            'full_opening_tag'                       => true,
12✔
157
            'fully_qualified_strict_types'           => [
12✔
158
                'import_symbols'                        => true,
12✔
159
                'leading_backslash_in_global_namespace' => false,
12✔
160
                'phpdoc_tags'                           => [
12✔
161
                    'param',
12✔
162
                    'phpstan-param',
12✔
163
                    'phpstan-property',
12✔
164
                    'phpstan-property-read',
12✔
165
                    'phpstan-property-write',
12✔
166
                    'phpstan-return',
12✔
167
                    'phpstan-var',
12✔
168
                    'property',
12✔
169
                    'property-read',
12✔
170
                    'property-write',
12✔
171
                    'psalm-param',
12✔
172
                    'psalm-property',
12✔
173
                    'psalm-property-read',
12✔
174
                    'psalm-property-write',
12✔
175
                    'psalm-return',
12✔
176
                    'psalm-var',
12✔
177
                    'return',
12✔
178
                    'throws',
12✔
179
                    'var',
12✔
180
                ],
12✔
181
            ],
12✔
182
            'function_declaration' => [
12✔
183
                'closure_function_spacing'   => 'one',
12✔
184
                'closure_fn_spacing'         => 'one',
12✔
185
                'trailing_comma_single_line' => false,
12✔
186
            ],
12✔
187
            'function_to_constant' => [
12✔
188
                'functions' => [
12✔
189
                    'get_called_class',
12✔
190
                    'get_class',
12✔
191
                    'get_class_this',
12✔
192
                    'php_sapi_name',
12✔
193
                    'phpversion',
12✔
194
                    'pi',
12✔
195
                ],
12✔
196
            ],
12✔
197
            'general_attribute_remove'         => ['attributes' => []],
12✔
198
            'general_phpdoc_annotation_remove' => [
12✔
199
                'annotations' => [
12✔
200
                    'author',
12✔
201
                    'package',
12✔
202
                    'subpackage',
12✔
203
                ],
12✔
204
                'case_sensitive' => false,
12✔
205
            ],
12✔
206
            'general_phpdoc_tag_rename' => [
12✔
207
                'case_sensitive' => false,
12✔
208
                'fix_annotation' => true,
12✔
209
                'fix_inline'     => true,
12✔
210
                'replacements'   => ['inheritDocs' => 'inheritDoc'],
12✔
211
            ],
12✔
212
            'get_class_to_class_keyword' => true,
12✔
213
            'global_namespace_import'    => [
12✔
214
                'import_constants' => false,
12✔
215
                'import_functions' => false,
12✔
216
                'import_classes'   => true,
12✔
217
            ],
12✔
218
            'group_import'                => false,
12✔
219
            'header_comment'              => false, // false by default
12✔
220
            'heredoc_closing_marker'      => false,
12✔
221
            'heredoc_indentation'         => ['indentation' => 'start_plus_one'],
12✔
222
            'heredoc_to_nowdoc'           => true,
12✔
223
            'implode_call'                => true,
12✔
224
            'include'                     => true,
12✔
225
            'increment_style'             => ['style' => 'post'],
12✔
226
            'indentation_type'            => true,
12✔
227
            'integer_literal_case'        => true,
12✔
228
            'is_null'                     => true,
12✔
229
            'lambda_not_used_import'      => true,
12✔
230
            'line_ending'                 => true,
12✔
231
            'linebreak_after_opening_tag' => true,
12✔
232
            'list_syntax'                 => ['syntax' => 'short'],
12✔
233
            'logical_operators'           => true,
12✔
234
            'long_to_shorthand_operator'  => true,
12✔
235
            'lowercase_cast'              => true,
12✔
236
            'lowercase_keywords'          => true,
12✔
237
            'lowercase_static_reference'  => true,
12✔
238
            'magic_constant_casing'       => true,
12✔
239
            'magic_method_casing'         => true,
12✔
240
            'mb_str_functions'            => false,
12✔
241
            'method_argument_space'       => [
12✔
242
                'keep_multiple_spaces_after_comma' => false,
12✔
243
                'on_multiline'                     => 'ensure_fully_multiline',
12✔
244
                'after_heredoc'                    => false,
12✔
245
                'attribute_placement'              => 'standalone',
12✔
246
            ],
12✔
247
            'method_chaining_indentation'            => true,
12✔
248
            'modernize_strpos'                       => ['modernize_stripos' => true],
12✔
249
            'modernize_types_casting'                => true,
12✔
250
            'multiline_comment_opening_closing'      => true,
12✔
251
            'multiline_string_to_heredoc'            => false,
12✔
252
            'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
12✔
253
            'native_constant_invocation'             => false,
12✔
254
            'native_function_casing'                 => true,
12✔
255
            'native_function_invocation'             => false,
12✔
256
            'native_type_declaration_casing'         => true,
12✔
257
            'new_with_parentheses'                   => [
12✔
258
                'named_class'     => true,
12✔
259
                'anonymous_class' => true,
12✔
260
            ],
12✔
261
            'no_alias_functions'                 => ['sets' => ['@all']],
12✔
262
            'no_alias_language_construct_call'   => true,
12✔
263
            'no_alternative_syntax'              => ['fix_non_monolithic_code' => false],
12✔
264
            'no_binary_string'                   => true,
12✔
265
            'no_blank_lines_after_class_opening' => true,
12✔
266
            'no_blank_lines_after_phpdoc'        => true,
12✔
267
            'no_break_comment'                   => ['comment_text' => 'no break'],
12✔
268
            'no_closing_tag'                     => true,
12✔
269
            'no_empty_comment'                   => true,
12✔
270
            'no_empty_phpdoc'                    => true,
12✔
271
            'no_empty_statement'                 => true,
12✔
272
            'no_extra_blank_lines'               => [
12✔
273
                'tokens' => [
12✔
274
                    'attribute',
12✔
275
                    'break',
12✔
276
                    'case',
12✔
277
                    'continue',
12✔
278
                    'curly_brace_block',
12✔
279
                    'default',
12✔
280
                    'extra',
12✔
281
                    'parenthesis_brace_block',
12✔
282
                    'return',
12✔
283
                    'square_brace_block',
12✔
284
                    'switch',
12✔
285
                    'throw',
12✔
286
                    'use',
12✔
287
                ],
12✔
288
            ],
12✔
289
            'no_homoglyph_names'                          => true,
12✔
290
            'no_leading_import_slash'                     => true,
12✔
291
            'no_leading_namespace_whitespace'             => true,
12✔
292
            'no_mixed_echo_print'                         => ['use' => 'echo'],
12✔
293
            'no_multiline_whitespace_around_double_arrow' => true,
12✔
294
            'no_multiple_statements_per_line'             => true,
12✔
295
            'no_null_property_initialization'             => true,
12✔
296
            'no_php4_constructor'                         => true,
12✔
297
            'no_short_bool_cast'                          => true,
12✔
298
            'no_singleline_whitespace_before_semicolons'  => true,
12✔
299
            'no_space_around_double_colon'                => true,
12✔
300
            'no_spaces_after_function_name'               => true,
12✔
301
            'no_spaces_around_offset'                     => ['positions' => ['inside', 'outside']],
12✔
302
            'no_superfluous_elseif'                       => true,
12✔
303
            'no_superfluous_phpdoc_tags'                  => [
12✔
304
                'allow_hidden_params' => true,
12✔
305
                'allow_mixed'         => true,
12✔
306
                'allow_unused_params' => true,
12✔
307
                'remove_inheritdoc'   => false,
12✔
308
            ],
12✔
309
            'no_trailing_comma_in_singleline' => [
12✔
310
                'elements' => [
12✔
311
                    'arguments',
12✔
312
                    'array_destructuring',
12✔
313
                    'array',
12✔
314
                    'group_import',
12✔
315
                ],
12✔
316
            ],
12✔
317
            'no_trailing_whitespace'            => true,
12✔
318
            'no_trailing_whitespace_in_comment' => true,
12✔
319
            'no_trailing_whitespace_in_string'  => true,
12✔
320
            'no_unneeded_braces'                => ['namespaces' => true],
12✔
321
            'no_unneeded_control_parentheses'   => [
12✔
322
                'statements' => [
12✔
323
                    'break',
12✔
324
                    'clone',
12✔
325
                    'continue',
12✔
326
                    'echo_print',
12✔
327
                    'return',
12✔
328
                    'switch_case',
12✔
329
                    'yield',
12✔
330
                ],
12✔
331
            ],
12✔
332
            'no_unneeded_final_method'                         => ['private_methods' => true],
12✔
333
            'no_unneeded_import_alias'                         => true,
12✔
334
            'no_unreachable_default_argument_value'            => true,
12✔
335
            'no_unset_cast'                                    => true,
12✔
336
            'no_unset_on_property'                             => false,
12✔
337
            'no_unused_imports'                                => true,
12✔
338
            'no_useless_concat_operator'                       => ['juggle_simple_strings' => true],
12✔
339
            'no_useless_else'                                  => true,
12✔
340
            'no_useless_nullsafe_operator'                     => true,
12✔
341
            'no_useless_return'                                => true,
12✔
342
            'no_useless_sprintf'                               => true,
12✔
343
            'no_whitespace_before_comma_in_array'              => ['after_heredoc' => true],
12✔
344
            'no_whitespace_in_blank_line'                      => true,
12✔
345
            'non_printable_character'                          => ['use_escape_sequences_in_strings' => true],
12✔
346
            'normalize_index_brace'                            => true,
12✔
347
            'not_operator_with_space'                          => false,
12✔
348
            'not_operator_with_successor_space'                => true,
12✔
349
            'nullable_type_declaration'                        => ['syntax' => 'question_mark'],
12✔
350
            'nullable_type_declaration_for_default_null_value' => true,
12✔
351
            'numeric_literal_separator'                        => false,
12✔
352
            'object_operator_without_whitespace'               => true,
12✔
353
            'octal_notation'                                   => false, // requires 8.1+
12✔
354
            'operator_linebreak'                               => ['only_booleans' => true, 'position' => 'beginning'],
12✔
355
            'ordered_attributes'                               => ['order' => [], 'sort_algorithm' => 'alpha'],
12✔
356
            'ordered_class_elements'                           => [
12✔
357
                'order' => [
12✔
358
                    'use_trait',
12✔
359
                    'case',
12✔
360
                    'constant',
12✔
361
                    'property',
12✔
362
                    'method',
12✔
363
                ],
12✔
364
                'sort_algorithm' => 'none',
12✔
365
                'case_sensitive' => false,
12✔
366
            ],
12✔
367
            'ordered_imports' => [
12✔
368
                'sort_algorithm' => 'alpha',
12✔
369
                'imports_order'  => ['class', 'function', 'const'],
12✔
370
                'case_sensitive' => false,
12✔
371
            ],
12✔
372
            'ordered_interfaces' => false,
12✔
373
            'ordered_traits'     => false,
12✔
374
            'ordered_types'      => [
12✔
375
                'null_adjustment' => 'always_last',
12✔
376
                'sort_algorithm'  => 'alpha',
12✔
377
                'case_sensitive'  => false,
12✔
378
            ],
12✔
379
            'php_unit_assert_new_names' => true,
12✔
380
            'php_unit_attributes'       => [
12✔
381
                'keep_annotations' => false,
12✔
382
            ],
12✔
383
            'php_unit_construct' => [
12✔
384
                'assertions' => [
12✔
385
                    'assertSame',
12✔
386
                    'assertEquals',
12✔
387
                    'assertNotEquals',
12✔
388
                    'assertNotSame',
12✔
389
                ],
12✔
390
            ],
12✔
391
            'php_unit_data_provider_method_order' => [
12✔
392
                'placement' => 'after',
12✔
393
            ],
12✔
394
            'php_unit_data_provider_name' => [
12✔
395
                'prefix' => 'provide',
12✔
396
                'suffix' => '',
12✔
397
            ],
12✔
398
            'php_unit_data_provider_return_type'     => true,
12✔
399
            'php_unit_data_provider_static'          => ['force' => true],
12✔
400
            'php_unit_dedicate_assert'               => ['target' => 'newest'],
12✔
401
            'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'],
12✔
402
            'php_unit_expectation'                   => ['target' => 'newest'],
12✔
403
            'php_unit_fqcn_annotation'               => true,
12✔
404
            'php_unit_internal_class'                => ['types' => ['normal', 'final']],
12✔
405
            'php_unit_method_casing'                 => ['case' => 'camel_case'],
12✔
406
            'php_unit_mock'                          => ['target' => 'newest'],
12✔
407
            'php_unit_mock_short_will_return'        => true,
12✔
408
            'php_unit_namespaced'                    => ['target' => 'newest'],
12✔
409
            'php_unit_no_expectation_annotation'     => [
12✔
410
                'target'          => 'newest',
12✔
411
                'use_class_const' => true,
12✔
412
            ],
12✔
413
            'php_unit_set_up_tear_down_visibility' => true,
12✔
414
            'php_unit_size_class'                  => false,
12✔
415
            'php_unit_strict'                      => [
12✔
416
                'assertions' => [
12✔
417
                    'assertAttributeEquals',
12✔
418
                    'assertAttributeNotEquals',
12✔
419
                    'assertEquals',
12✔
420
                    'assertNotEquals',
12✔
421
                ],
12✔
422
            ],
12✔
423
            'php_unit_test_annotation'               => ['style' => 'prefix'],
12✔
424
            'php_unit_test_case_static_method_calls' => [
12✔
425
                'call_type' => 'this',
12✔
426
                'methods'   => [],
12✔
427
            ],
12✔
428
            'php_unit_test_class_requires_covers' => false,
12✔
429
            'phpdoc_add_missing_param_annotation' => ['only_untyped' => true],
12✔
430
            'phpdoc_align'                        => [
12✔
431
                'align'   => 'vertical',
12✔
432
                'spacing' => 1,
12✔
433
                'tags'    => [
12✔
434
                    'method',
12✔
435
                    'param',
12✔
436
                    'phpstan-assert',
12✔
437
                    'phpstan-assert-if-true',
12✔
438
                    'phpstan-assert-if-false',
12✔
439
                    'phpstan-param',
12✔
440
                    'phpstan-property',
12✔
441
                    'phpstan-return',
12✔
442
                    'phpstan-type',
12✔
443
                    'phpstan-var',
12✔
444
                    'property',
12✔
445
                    'property-read',
12✔
446
                    'property-write',
12✔
447
                    'return',
12✔
448
                    'throws',
12✔
449
                    'type',
12✔
450
                    'var',
12✔
451
                ],
12✔
452
            ],
12✔
453
            'phpdoc_annotation_without_dot' => false,
12✔
454
            'phpdoc_array_type'             => true,
12✔
455
            'phpdoc_indent'                 => true,
12✔
456
            'phpdoc_inline_tag_normalizer'  => [
12✔
457
                'tags' => [
12✔
458
                    'example',
12✔
459
                    'id',
12✔
460
                    'internal',
12✔
461
                    'inheritdoc',
12✔
462
                    'inheritdocs',
12✔
463
                    'link',
12✔
464
                    'source',
12✔
465
                    'toc',
12✔
466
                    'tutorial',
12✔
467
                ],
12✔
468
            ],
12✔
469
            'phpdoc_line_span' => [
12✔
470
                'const'    => 'multi',
12✔
471
                'method'   => 'multi',
12✔
472
                'property' => 'multi',
12✔
473
            ],
12✔
474
            'phpdoc_list_type'    => true,
12✔
475
            'phpdoc_no_access'    => true,
12✔
476
            'phpdoc_no_alias_tag' => [
12✔
477
                'replacements' => [
12✔
478
                    'type' => 'var',
12✔
479
                    'link' => 'see',
12✔
480
                ],
12✔
481
            ],
12✔
482
            'phpdoc_no_empty_return'       => false,
12✔
483
            'phpdoc_no_package'            => true,
12✔
484
            'phpdoc_no_useless_inheritdoc' => true,
12✔
485
            'phpdoc_order'                 => [
12✔
486
                'order' => ['param', 'return', 'throws'],
12✔
487
            ],
12✔
488
            'phpdoc_order_by_value' => [
12✔
489
                'annotations' => [
12✔
490
                    'author',
12✔
491
                    'covers',
12✔
492
                    'coversNothing',
12✔
493
                    'dataProvider',
12✔
494
                    'depends',
12✔
495
                    'group',
12✔
496
                    'internal',
12✔
497
                    'method',
12✔
498
                    'property',
12✔
499
                    'property-read',
12✔
500
                    'property-write',
12✔
501
                    'requires',
12✔
502
                    'throws',
12✔
503
                    'uses',
12✔
504
                ],
12✔
505
            ],
12✔
506
            'phpdoc_param_order'                       => false,
12✔
507
            'phpdoc_readonly_class_comment_to_keyword' => false,
12✔
508
            'phpdoc_return_self_reference'             => [
12✔
509
                'replacements' => [
12✔
510
                    'this'    => '$this',
12✔
511
                    '@this'   => '$this',
12✔
512
                    '$self'   => 'self',
12✔
513
                    '@self'   => 'self',
12✔
514
                    '$static' => 'static',
12✔
515
                    '@static' => 'static',
12✔
516
                ],
12✔
517
            ],
12✔
518
            'phpdoc_scalar' => [
12✔
519
                'types' => [
12✔
520
                    'boolean',
12✔
521
                    'callback',
12✔
522
                    'double',
12✔
523
                    'integer',
12✔
524
                    'real',
12✔
525
                    'str',
12✔
526
                ],
12✔
527
            ],
12✔
528
            'phpdoc_separation' => [
12✔
529
                'groups' => [
12✔
530
                    ['immutable', 'psalm-immutable'],
12✔
531
                    ['param', 'phpstan-param', 'psalm-param'],
12✔
532
                    ['phpstan-pure', 'psalm-pure'],
12✔
533
                    ['readonly', 'psalm-readonly'],
12✔
534
                    ['return', 'phpstan-return', 'psalm-return'],
12✔
535
                    ['runTestsInSeparateProcess', 'runInSeparateProcess', 'preserveGlobalState'],
12✔
536
                    ['template', 'phpstan-template', 'psalm-template'],
12✔
537
                    ['template-covariant', 'phpstan-template-covariant', 'psalm-template-covariant'],
12✔
538
                    ['phpstan-type', 'psalm-type'],
12✔
539
                    ['var', 'phpstan-var', 'psalm-var'],
12✔
540
                ],
12✔
541
                'skip_unlisted_annotations' => true,
12✔
542
            ],
12✔
543
            'phpdoc_single_line_var_spacing'                => true,
12✔
544
            'phpdoc_summary'                                => false,
12✔
545
            'phpdoc_tag_casing'                             => ['tags' => ['inheritDoc']],
12✔
546
            'phpdoc_tag_type'                               => ['tags' => ['inheritDoc' => 'inline']],
12✔
547
            'phpdoc_to_comment'                             => false,
12✔
548
            'phpdoc_to_param_type'                          => false,
12✔
549
            'phpdoc_to_property_type'                       => false,
12✔
550
            'phpdoc_to_return_type'                         => false,
12✔
551
            'phpdoc_trim'                                   => true,
12✔
552
            'phpdoc_trim_consecutive_blank_line_separation' => true,
12✔
553
            'phpdoc_types'                                  => ['groups' => ['simple', 'alias', 'meta']],
12✔
554
            'phpdoc_types_order'                            => [
12✔
555
                'null_adjustment' => 'always_last',
12✔
556
                'sort_algorithm'  => 'alpha',
12✔
557
                'case_sensitive'  => false,
12✔
558
            ],
12✔
559
            'phpdoc_var_annotation_correct_order' => true,
12✔
560
            'phpdoc_var_without_name'             => true,
12✔
561
            'pow_to_exponentiation'               => true,
12✔
562
            'protected_to_private'                => true,
12✔
563
            'psr_autoloading'                     => ['dir' => null],
12✔
564
            'random_api_migration'                => [
12✔
565
                'replacements' => [
12✔
566
                    'getrandmax' => 'mt_getrandmax',
12✔
567
                    'rand'       => 'mt_rand',
12✔
568
                    'srand'      => 'mt_srand',
12✔
569
                ],
12✔
570
            ],
12✔
571
            'regular_callable_call'              => true,
12✔
572
            'return_assignment'                  => true,
12✔
573
            'return_to_yield_from'               => false,
12✔
574
            'return_type_declaration'            => ['space_before' => 'none'],
12✔
575
            'self_accessor'                      => false,
12✔
576
            'self_static_accessor'               => true,
12✔
577
            'semicolon_after_instruction'        => false,
12✔
578
            'set_type_to_cast'                   => true,
12✔
579
            'short_scalar_cast'                  => true,
12✔
580
            'simple_to_complex_string_variable'  => true,
12✔
581
            'simplified_if_return'               => true,
12✔
582
            'simplified_null_return'             => false,
12✔
583
            'single_blank_line_at_eof'           => true,
12✔
584
            'single_class_element_per_statement' => ['elements' => ['const', 'property']],
12✔
585
            'single_import_per_statement'        => ['group_to_single_imports' => true],
12✔
586
            'single_line_after_imports'          => true,
12✔
587
            'single_line_comment_spacing'        => true,
12✔
588
            'single_line_comment_style'          => ['comment_types' => ['asterisk', 'hash']],
12✔
589
            'single_line_empty_body'             => false,
12✔
590
            'single_line_throw'                  => false,
12✔
591
            'single_quote'                       => ['strings_containing_single_quote_chars' => false],
12✔
592
            'single_space_around_construct'      => [
12✔
593
                'constructs_contain_a_single_space'     => ['yield_from'],
12✔
594
                'constructs_preceded_by_a_single_space' => ['use_lambda'],
12✔
595
                'constructs_followed_by_a_single_space' => [
12✔
596
                    'abstract',
12✔
597
                    'as',
12✔
598
                    'attribute',
12✔
599
                    'break',
12✔
600
                    'case',
12✔
601
                    'catch',
12✔
602
                    'class',
12✔
603
                    'clone',
12✔
604
                    'comment',
12✔
605
                    'const',
12✔
606
                    'const_import',
12✔
607
                    'continue',
12✔
608
                    'do',
12✔
609
                    'echo',
12✔
610
                    'else',
12✔
611
                    'elseif',
12✔
612
                    'enum',
12✔
613
                    'extends',
12✔
614
                    'final',
12✔
615
                    'finally',
12✔
616
                    'for',
12✔
617
                    'foreach',
12✔
618
                    'function',
12✔
619
                    'function_import',
12✔
620
                    'global',
12✔
621
                    'goto',
12✔
622
                    'if',
12✔
623
                    'implements',
12✔
624
                    'include',
12✔
625
                    'include_once',
12✔
626
                    'instanceof',
12✔
627
                    'insteadof',
12✔
628
                    'interface',
12✔
629
                    'match',
12✔
630
                    'named_argument',
12✔
631
                    'namespace',
12✔
632
                    'new',
12✔
633
                    'open_tag_with_echo',
12✔
634
                    'php_doc',
12✔
635
                    'php_open',
12✔
636
                    'print',
12✔
637
                    'private',
12✔
638
                    'protected',
12✔
639
                    'public',
12✔
640
                    'readonly',
12✔
641
                    'require',
12✔
642
                    'require_once',
12✔
643
                    'return',
12✔
644
                    'static',
12✔
645
                    'switch',
12✔
646
                    'throw',
12✔
647
                    'trait',
12✔
648
                    'try',
12✔
649
                    'type_colon',
12✔
650
                    'use',
12✔
651
                    'use_lambda',
12✔
652
                    'use_trait',
12✔
653
                    'var',
12✔
654
                    'while',
12✔
655
                    'yield',
12✔
656
                    'yield_from',
12✔
657
                ],
12✔
658
            ],
12✔
659
            'single_trait_insert_per_statement' => true,
12✔
660
            'space_after_semicolon'             => ['remove_in_empty_for_expressions' => true],
12✔
661
            'spaces_inside_parentheses'         => ['space' => 'none'],
12✔
662
            'standardize_increment'             => true,
12✔
663
            'standardize_not_equals'            => true,
12✔
664
            'statement_indentation'             => ['stick_comment_to_next_continuous_control_statement' => false],
12✔
665
            'static_lambda'                     => true,
12✔
666
            'strict_comparison'                 => true,
12✔
667
            'strict_param'                      => true,
12✔
668
            'string_implicit_backslashes'       => [
12✔
669
                'double_quoted' => 'escape',
12✔
670
                'heredoc'       => 'escape',
12✔
671
                'single_quoted' => 'ignore',
12✔
672
            ],
12✔
673
            'string_length_to_empty'         => true,
12✔
674
            'string_line_ending'             => true,
12✔
675
            'switch_case_semicolon_to_colon' => true,
12✔
676
            'switch_case_space'              => true,
12✔
677
            'switch_continue_to_break'       => true,
12✔
678
            'ternary_operator_spaces'        => true,
12✔
679
            'ternary_to_elvis_operator'      => true,
12✔
680
            'ternary_to_null_coalescing'     => true,
12✔
681
            'trailing_comma_in_multiline'    => [
12✔
682
                'after_heredoc' => true,
12✔
683
                'elements'      => [
12✔
684
                    'arguments',
12✔
685
                    'array_destructuring',
12✔
686
                    'arrays',
12✔
687
                    'match',
12✔
688
                    'parameters',
12✔
689
                ],
12✔
690
            ],
12✔
691
            'trim_array_spaces'       => true,
12✔
692
            'type_declaration_spaces' => ['elements' => ['function', 'property']],
12✔
693
            'types_spaces'            => [
12✔
694
                'space'                => 'none',
12✔
695
                'space_multiple_catch' => 'none',
12✔
696
            ],
12✔
697
            'unary_operator_spaces'           => ['only_dec_inc' => false],
12✔
698
            'use_arrow_functions'             => true,
12✔
699
            'visibility_required'             => ['elements' => ['const', 'method', 'property']],
12✔
700
            'void_return'                     => false, // changes method signature
12✔
701
            'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
12✔
702
            'yield_from_array_to_yields'      => false,
12✔
703
            'yoda_style'                      => [
12✔
704
                'equal'                => false,
12✔
705
                'identical'            => null,
12✔
706
                'less_and_greater'     => false,
12✔
707
                'always_move_variable' => false,
12✔
708
            ],
12✔
709
        ];
12✔
710

711
        $this->requiredPHPVersion = 80100;
12✔
712

713
        $this->autoActivateIsRiskyAllowed = true;
12✔
714
    }
715
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc