Skip to content

Commit 7551a9f

Browse files
committed
Preparation for Php8.4
Backport changes applied to master some time ago.
1 parent fb42a10 commit 7551a9f

File tree

16 files changed

+1667
-764
lines changed

16 files changed

+1667
-764
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ jobs:
1414
- '8.2'
1515
- '8.3'
1616

17+
include:
18+
- php-version: 'nightly'
19+
experimental: true
20+
1721
name: PHP ${{ matrix.php-version }}
1822

1923
steps:
@@ -40,7 +44,7 @@ jobs:
4044

4145
- name: Delete composer lock file
4246
id: composer-lock
43-
if: ${{ matrix.php-version == '8.1' || matrix.php-version == '8.2' || matrix.php-version == '8.3' }}
47+
if: ${{ matrix.php-version == '8.1' || matrix.php-version == '8.2' || matrix.php-version == '8.3' || matrix.php-version == 'nightly'}}
4448
run: |
4549
rm composer.lock
4650
echo "flags=--ignore-platform-reqs" >> $GITHUB_OUTPUT
@@ -63,7 +67,7 @@ jobs:
6367
- name: "Run PHPUnit tests 2 (Experimental: ${{ matrix.experimental }})"
6468
env:
6569
FAILURE_ACTION: "${{ matrix.experimental == true }}"
66-
if: ${{ matrix.php-version == '8.1' || matrix.php-version == '8.2' || matrix.php-version == '8.3' }}
70+
if: ${{ matrix.php-version == '8.1' || matrix.php-version == '8.2' || matrix.php-version == '8.3' || matrix.php-version == 'nightly'}}
6771
run: vendor/bin/phpunit --verbose || $FAILURE_ACTION
6872

6973
php-cs-fixer:

.php-cs-fixer.dist.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
$config
1010
->setRiskyAllowed(true)
1111
->setFinder($finder)
12+
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect(null, 600))
1213
->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer' . preg_replace('~\W~', '-', __DIR__))
1314
->setRules([
1415
'align_multiline_comment' => true,
@@ -18,15 +19,16 @@
1819
'binary_operator_spaces' => true,
1920
'blank_line_after_namespace' => true,
2021
'blank_line_after_opening_tag' => true,
21-
'blank_line_before_statement' => true,
22+
'blank_line_before_statement' => false,
23+
'blank_lines_before_namespace' => ['max_line_breaks' => 2, 'min_line_breaks' => 2], // we want 1 blank line before namespace
2224
'cast_spaces' => true,
2325
'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']], // const are often grouped with other related const
2426
'class_definition' => false,
2527
'combine_consecutive_issets' => true,
2628
'combine_consecutive_unsets' => true,
2729
'combine_nested_dirname' => true,
2830
'comment_to_phpdoc' => false, // interferes with annotations
29-
'compact_nullable_typehint' => true,
31+
'compact_nullable_type_declaration' => true,
3032
'concat_space' => ['spacing' => 'one'],
3133
'constant_case' => true,
3234
'date_time_immutable' => false, // Break our unit tests
@@ -40,7 +42,6 @@
4042
'elseif' => true,
4143
'encoding' => true,
4244
'ereg_to_preg' => true,
43-
'escape_implicit_backslashes' => true,
4445
'explicit_indirect_variable' => false, // I feel it makes the code actually harder to read
4546
'explicit_string_variable' => false, // I feel it makes the code actually harder to read
4647
'final_class' => false, // We need non-final classes
@@ -50,10 +51,9 @@
5051
'fopen_flag_order' => true,
5152
'fopen_flags' => true,
5253
'full_opening_tag' => true,
53-
'fully_qualified_strict_types' => true,
54+
'fully_qualified_strict_types' => false,
5455
'function_declaration' => true,
5556
'function_to_constant' => true,
56-
'function_typehint_space' => true,
5757
'general_phpdoc_annotation_remove' => ['annotations' => ['access', 'category', 'copyright']],
5858
'global_namespace_import' => true,
5959
'header_comment' => false, // We don't use common header in all our files
@@ -82,14 +82,12 @@
8282
'native_constant_invocation' => false, // Micro optimization that look messy
8383
'native_function_casing' => true,
8484
'native_function_invocation' => false, // I suppose this would be best, but I am still unconvinced about the visual aspect of it
85-
'native_function_type_declaration_casing' => true,
86-
'new_with_braces' => true,
85+
'new_with_parentheses' => ['anonymous_class' => true, 'named_class' => true],
8786
'no_alias_functions' => true,
8887
'no_alternative_syntax' => true,
8988
'no_binary_string' => true,
9089
'no_blank_lines_after_class_opening' => true,
9190
'no_blank_lines_after_phpdoc' => true,
92-
'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace
9391
'no_break_comment' => true,
9492
'no_closing_tag' => true,
9593
'no_empty_comment' => true,
@@ -108,14 +106,13 @@
108106
'no_singleline_whitespace_before_semicolons' => true,
109107
'no_spaces_after_function_name' => true,
110108
'no_spaces_around_offset' => true,
111-
'no_spaces_inside_parenthesis' => true,
112109
'no_superfluous_elseif' => false, // Might be risky on a huge code base
113-
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
110+
//'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
114111
'no_trailing_comma_in_singleline' => ['elements' => ['arguments', 'array_destructuring', 'array', 'group_import']],
115112
'no_trailing_whitespace' => true,
116113
'no_trailing_whitespace_in_comment' => true,
117114
'no_unneeded_control_parentheses' => true,
118-
'no_unneeded_curly_braces' => true,
115+
'no_unneeded_braces' => true,
119116
'no_unneeded_final_method' => true,
120117
'no_unreachable_default_argument_value' => true,
121118
'no_unset_cast' => true,
@@ -175,7 +172,7 @@
175172
'phpdoc_trim' => true,
176173
'phpdoc_trim_consecutive_blank_line_separation' => true,
177174
'phpdoc_types' => true,
178-
'phpdoc_types_order' => true,
175+
'phpdoc_types_order' => false,
179176
'phpdoc_var_annotation_correct_order' => true,
180177
'phpdoc_var_without_name' => true,
181178
'pow_to_exponentiation' => true,
@@ -193,27 +190,29 @@
193190
'simple_to_complex_string_variable' => false, // Would differ from TypeScript without obvious advantages
194191
'simplified_null_return' => false, // Even if technically correct we prefer to be explicit
195192
'single_blank_line_at_eof' => true,
196-
'single_blank_line_before_namespace' => true,
197193
'single_class_element_per_statement' => true,
198194
'single_import_per_statement' => true,
199195
'single_line_after_imports' => true,
200196
'single_line_comment_style' => true,
201197
'single_line_throw' => false, // I don't see any reason for having a special case for Exception
202-
'single_quote' => true,
198+
'single_quote' => false,
203199
'single_trait_insert_per_statement' => true,
204200
'space_after_semicolon' => true,
201+
'spaces_inside_parentheses' => ['space' => 'none'],
205202
'standardize_increment' => true,
206203
'standardize_not_equals' => true,
207204
'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()`
208205
'strict_comparison' => false, // No, too dangerous to change that
209206
'strict_param' => false, // No, too dangerous to change that
207+
'string_implicit_backslashes' => false, // was escape_implicit_backslashes, too confusing
210208
'string_line_ending' => true,
211209
'switch_case_semicolon_to_colon' => true,
212210
'switch_case_space' => true,
213211
'ternary_operator_spaces' => true,
214212
'ternary_to_null_coalescing' => true,
215213
'trailing_comma_in_multiline' => true,
216214
'trim_array_spaces' => true,
215+
'type_declaration_spaces' => ['elements' => ['function', 'property']], // was function_typehint_space
217216
'unary_operator_spaces' => true,
218217
'visibility_required' => ['elements' => ['property', 'method']], // not const
219218
'void_return' => true,

0 commit comments

Comments
 (0)