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

CodeIgniter / coding-standard / 16373850390

18 Jul 2025 03:04PM UTC coverage: 100.0%. Remained the same
16373850390

push

github

paulbalandan
Prepare changelog for v1.8.7

688 of 688 relevant lines covered (100.0%)

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

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

715
        $this->requiredPHPVersion = 80100;
20✔
716

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

© 2025 Coveralls, Inc