Skip to content

Commit 5db5460

Browse files
authored
Merge pull request #12 from InteractionDesignFoundation/update-coding-standard
Update to coding-standard ^0.7
2 parents a231f2e + ca46d62 commit 5db5460

File tree

3 files changed

+7
-132
lines changed

3 files changed

+7
-132
lines changed

.php-cs-fixer.php

Lines changed: 3 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,5 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

3-
declare(strict_types=1);
3+
use IxDFCodingStandard\PhpCsFixer\Config;
44

5-
/**
6-
* @see https://mlocati.github.io/php-cs-fixer-configurator/
7-
*/
8-
$finder = \PhpCsFixer\Finder::create()
9-
->in(__DIR__)
10-
->exclude(
11-
[
12-
'vendor',
13-
]
14-
)
15-
->name('*.php')
16-
->ignoreDotFiles(false)
17-
->ignoreVCS(true)
18-
->ignoreVCSIgnored(true);
19-
20-
return (new \PhpCsFixer\Config())
21-
->setUsingCache(true)
22-
->setRiskyAllowed(true)
23-
->setIndent(' ')
24-
->setLineEnding("\n")
25-
->setRules([
26-
// Basic PER Coding Style 2.0 ruleset plus our "fixes" for it
27-
'@PER-CS2.0' => true, // https://www.php-fig.org/per/coding-style/}
28-
// 'concat_space' => ['spacing' => 'none'], // make strings shorter "'hello' . $name . '!'" => "'hello'.$name.'!'"
29-
// 'blank_line_after_opening_tag' => false, // it makes "<?php declare(strict_types=1);" multiline (and more verbose)
30-
'function_declaration' => false, // It makes "fn ()" into "fn()" and conflicts with our PHPCS ruleset
31-
'single_line_empty_body' => false, // It has conflict with PSR2.Classes.ClassDeclaration.OpenBraceNewLine
32-
// 'unary_operator_spaces' => false, // It has conflict with PHPCS ruleset
33-
34-
// Additional rules on the top of PER-CS2
35-
// Please keep these rules alphabetically
36-
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'],
37-
'array_indentation' => true,
38-
'assign_null_coalescing_to_coalesce_equal' => true,
39-
'binary_operator_spaces' => ['default' => 'single_space'],
40-
'cast_spaces' => ['space' => 'single'],
41-
'class_attributes_separation' => ['elements' => ['method' => 'one']],
42-
'declare_strict_types' => true,
43-
'explicit_string_variable' => true,
44-
// 'final_public_method_for_abstract_class' => true, // @todo enable it
45-
'general_phpdoc_annotation_remove' => [
46-
'annotations' => [
47-
'api',
48-
'access',
49-
'author',
50-
'category',
51-
'copyright',
52-
'created',
53-
'license',
54-
'link',
55-
'package',
56-
'since',
57-
'subpackage',
58-
'version',
59-
],
60-
],
61-
'modernize_types_casting' => true,
62-
'no_alias_functions' => true,
63-
'no_binary_string' => true,
64-
'no_empty_comment' => true,
65-
'no_empty_phpdoc' => true,
66-
'no_empty_statement' => true,
67-
'no_extra_blank_lines' => ['tokens' => ['extra', 'curly_brace_block']],
68-
'no_homoglyph_names' => true,
69-
'no_leading_namespace_whitespace' => true,
70-
'no_mixed_echo_print' => true,
71-
'no_short_bool_cast' => true,
72-
'no_singleline_whitespace_before_semicolons' => true,
73-
'no_spaces_around_offset' => true,
74-
'no_trailing_comma_in_singleline' => false, // it's a good marker that there are more elements in an array
75-
'no_unneeded_braces' => true,
76-
'no_unneeded_control_parentheses' => true,
77-
'no_unneeded_final_method' => true,
78-
'no_unreachable_default_argument_value' => true,
79-
'no_unused_imports' => true,
80-
'no_useless_concat_operator' => true,
81-
'no_useless_return' => true,
82-
'no_whitespace_before_comma_in_array' => true,
83-
'normalize_index_brace' => true,
84-
'nullable_type_declaration' => ['syntax' => 'question_mark'],
85-
'object_operator_without_whitespace' => true,
86-
/*
87-
* @see https://github.com/slevomat/coding-standard/issues/1620#issuecomment-1758006718
88-
* 'ordered_class_elements' => [
89-
'order' => [
90-
'use_trait',
91-
'constant',
92-
'case', // for enums only
93-
'property',
94-
'method',
95-
]
96-
],*/
97-
'php_unit_construct' => true,
98-
'php_unit_dedicate_assert' => ['target' => 'newest'],
99-
'php_unit_expectation' => true,
100-
'php_unit_fqcn_annotation' => true,
101-
'php_unit_method_casing' => ['case' => 'snake_case'],
102-
'php_unit_no_expectation_annotation' => true,
103-
'php_unit_set_up_tear_down_visibility' => true,
104-
'php_unit_strict' => true,
105-
'php_unit_test_annotation' => ['style' => 'annotation'],
106-
'php_unit_test_class_requires_covers' => true,
107-
'phpdoc_align' => ['align' => 'left'],
108-
'phpdoc_indent' => true,
109-
'phpdoc_line_span' => ['const' => 'single', 'property' => 'single', 'method' => 'single'],
110-
'phpdoc_param_order' => true,
111-
'phpdoc_scalar' => true,
112-
'phpdoc_single_line_var_spacing' => true,
113-
'phpdoc_tag_casing' => true,
114-
'phpdoc_types' => true,
115-
'protected_to_private' => true,
116-
'psr_autoloading' => true,
117-
'self_accessor' => true,
118-
'self_static_accessor' => true,
119-
'single_line_comment_spacing' => true,
120-
'single_line_comment_style' => ['comment_types' => ['asterisk', 'hash']],
121-
'space_after_semicolon' => true,
122-
'standardize_not_equals' => true,
123-
'strict_param' => true,
124-
'ternary_to_null_coalescing' => true,
125-
'trim_array_spaces' => true,
126-
'trailing_comma_in_multiline' => true,
127-
'type_declaration_spaces' => true,
128-
'types_spaces' => ['space' => 'single'],
129-
'whitespace_after_comma_in_array' => true,
130-
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
131-
])
132-
->setFinder($finder);
5+
return Config::create(__DIR__);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"laravel/nova": "^4.25 || ^5.0"
1515
},
1616
"require-dev": {
17-
"interaction-design-foundation/coding-standard": "^0.3.0",
17+
"interaction-design-foundation/coding-standard": "^0.7",
1818
"orchestra/testbench-core": "^8.0 || ^9.0 || ^10.0 || ^11.0",
1919
"phpunit/phpunit": "^10.5 || ^11.0"
2020
},

src/HtmlCode.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
use Laravel\Nova\Fields\Textarea;
66

7-
/** @phpcs:disable SlevomatCodingStandard.Classes.RequireAbstractOrFinal */
7+
/**
8+
* @phpcs:disable SlevomatCodingStandard.Classes.RequireAbstractOrFinal
9+
*/
810
class HtmlCode extends Textarea
911
{
1012
/**

0 commit comments

Comments
 (0)