Skip to content

Commit 7fb8066

Browse files
committed
Use Netgen Coding Standard
1 parent 7aa2ebb commit 7fb8066

File tree

3 files changed

+9
-43
lines changed

3 files changed

+9
-43
lines changed

.github/workflows/coding_standards.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v6
17+
- uses: actions/checkout@v6
18+
with:
19+
repository: netgen/coding-standard
20+
path: vendor/netgen/coding-standard
1721
- uses: docker://oskarstark/php-cs-fixer-ga
1822
with:
1923
args: --diff --dry-run

.php-cs-fixer.php

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,9 @@
11
<?php
22

3-
return (new PhpCsFixer\Config())
4-
->setRiskyAllowed(true)
5-
->setRules([
6-
'@PER' => true,
7-
'@PER:risky' => true,
8-
'@PhpCsFixer' => true,
9-
'@PhpCsFixer:risky' => true,
3+
// To support running PHP CS Fixer via PHAR file (e.g. in GitHub Actions)
4+
require_once __DIR__ . '/vendor/netgen/coding-standard/lib/PhpCsFixer/Config.php';
105

11-
// Overrides for rules included in PhpCsFixer rule sets
12-
'concat_space' => ['spacing' => 'one'],
13-
'method_chaining_indentation' => false,
14-
'multiline_whitespace_before_semicolons' => false,
15-
'native_function_invocation' => ['include' => ['@all']],
16-
'no_superfluous_phpdoc_tags' => false,
17-
'no_unset_on_property' => false,
18-
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
19-
'ordered_types' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'alpha'],
20-
'php_unit_internal_class' => false,
21-
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
22-
'php_unit_test_class_requires_covers' => false,
23-
'phpdoc_align' => false,
24-
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
25-
'single_line_comment_style' => false,
26-
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments', 'match', 'parameters']],
27-
'yoda_style' => false,
28-
29-
// Additional rules
30-
'date_time_immutable' => true,
31-
'declare_strict_types' => true,
32-
'global_namespace_import' => [
33-
'import_classes' => null,
34-
'import_constants' => true,
35-
'import_functions' => true,
36-
],
37-
'list_syntax' => ['syntax' => 'short'],
38-
'heredoc_indentation' => ['indentation' => 'same_as_start'],
39-
'mb_str_functions' => true,
40-
'native_constant_invocation' => true,
41-
'nullable_type_declaration_for_default_null_value' => true,
42-
'static_lambda' => true,
43-
'ternary_to_null_coalescing' => true,
44-
'use_arrow_functions' => true,
45-
])
6+
return new Netgen\CodingStandard\PhpCsFixer\Config()
467
->setFinder(
478
PhpCsFixer\Finder::create()
489
->in('src')

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"symfony/process": "^5.4 || ^6.3 || ^7.0"
2323
},
2424
"require-dev": {
25+
"netgen/coding-standard": "^1.0",
2526
"composer/composer": "^2.5",
2627
"php-cs-fixer/shim": "^3.15",
2728
"phpstan/phpstan": "^1.9",

0 commit comments

Comments
 (0)