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

CodeIgniter / coding-standard / 16088824071

05 Jul 2025 01:58PM UTC coverage: 100.0%. Remained the same
16088824071

push

github

paulbalandan
Prepare changelog for v1.8.6

687 of 687 relevant lines covered (100.0%)

16.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';
16✔
28

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

714
        $this->requiredPHPVersion = 80100;
16✔
715

716
        $this->autoActivateIsRiskyAllowed = true;
16✔
717
    }
718
}
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