Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4ca51dd

Browse files
committed
Feat: Remove SingleLineCommentSpacingFixer and MultilineStringToHeredocFixer from default checks, keep them suggested in README
1 parent e948b07 commit 4ca51dd

File tree

5 files changed

+8
-25
lines changed

5 files changed

+8
-25
lines changed

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ return ECSConfig::configure()
8282
[
8383
// PHPUnit attributes must be used over their respective PHPDoc-based annotations. (Use with PHPUnit 10+.)
8484
PhpUnitAttributesFixer::class,
85-
// Single-line comments must have proper spacing.
85+
// Single-line comments must have proper spacing (one space after `//`).
8686
SingleLineCommentSpacingFixer::class,
87+
// Convert multiline string to heredoc or nowdoc.
88+
MultilineStringToHeredocFixer::class,
8789
]
8890
)
8991
// Enforce line-length to 120 characters.

‎UPGRADE-4.0.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ $ vendor/bin/ecs check --ansi src/ tests/ # old
8585
$ vendor/bin/ecs check --ansi # new
8686
```
8787

88+
### 6. Add some optional rules
89+
On top of default rules included in ecs.php, there are some more opinionated ones you may want to add.
90+
91+
These suggested rules are listed in [README.md](https://github.com/lmc-eu/php-coding-standard?tab=readme-ov-file#add-custom-checks-or-override-default-settings).
92+
8893
### 5. BE CAREFUL WITH SUGGESTED CHANGES! ⚠️
8994

9095
Some of the new default fixers introduced in php-coding-standard 4.0 and 4.1 suggest changes, which - if not

‎ecs.php‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
use PhpCsFixer\Fixer\ClassNotation\SingleTraitInsertPerStatementFixer;
6565
use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
6666
use PhpCsFixer\Fixer\Comment\NoEmptyCommentFixer;
67-
use PhpCsFixer\Fixer\Comment\SingleLineCommentSpacingFixer;
6867
use PhpCsFixer\Fixer\ControlStructure\NoUnneededControlParenthesesFixer;
6968
use PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer;
7069
use PhpCsFixer\Fixer\ControlStructure\SwitchContinueToBreakFixer;
@@ -148,7 +147,6 @@
148147
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
149148
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
150149
use PhpCsFixer\Fixer\Strict\StrictParamFixer;
151-
use PhpCsFixer\Fixer\StringNotation\MultilineStringToHeredocFixer;
152150
use PhpCsFixer\Fixer\StringNotation\SimpleToComplexStringVariableFixer;
153151
use PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer;
154152
use PhpCsFixer\Fixer\Whitespace\ArrayIndentationFixer;
@@ -283,8 +281,6 @@
283281
SingleTraitInsertPerStatementFixer::class,
284282
// There should not be any empty comments
285283
NoEmptyCommentFixer::class,
286-
// Single-line comments must have proper spacing.
287-
SingleLineCommentSpacingFixer::class,
288284
// There should not be useless `else` cases
289285
NoUselessElseFixer::class,
290286
// Switch case must not be ended with `continue` but with `break`.
@@ -417,8 +413,6 @@
417413
StrictParamFixer::class,
418414
// Comparisons should be strict, `===` or `!==` must be used for comparisons
419415
StrictComparisonFixer::class,
420-
// Convert multiline string to heredoc or nowdoc.
421-
MultilineStringToHeredocFixer::class,
422416
// Converts explicit variables in double-quoted strings from simple to complex format (${ to {$).
423417
SimpleToComplexStringVariableFixer::class,
424418
// Convert double quotes to single quotes for simple strings

‎tests/Integration/Fixtures/Basic.correct.php.inc‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,6 @@ class Basic extends AbstractBasic implements InterfaceFromThisNamespace // Fully
9595
$newdoc = <<<'NEWDOC'
9696
This is a $newdoc, where variables are not expanded.
9797
NEWDOC;
98-
// MultilineStringToHeredocFixer
99-
$multilineString = <<<'EOD'
100-
This string
101-
spans multiple lines
102-
but should be heredoc instead
103-
EOD;
104-
105-
// SingleLineCommentSpacingFixer
106-
// This comment should have space on the beginning
107-
/* So should this one, also with space on the end */
10898

10999
// TernaryToElvisOperatorFixer
110100
return ($foo ?: 'not true');

‎tests/Integration/Fixtures/Basic.wrong.php.inc‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,6 @@ HEREDOC;
8181
$newdoc = <<<'NEWDOC'
8282
This is a $newdoc, where variables are not expanded.
8383
NEWDOC;
84-
// MultilineStringToHeredocFixer
85-
$multilineString = 'This string
86-
spans multiple lines
87-
but should be heredoc instead';
88-
89-
// SingleLineCommentSpacingFixer
90-
//This comment should have space on the beginning
91-
/*So should this one, also with space on the end*/
9284

9385
// TernaryToElvisOperatorFixer
9486
return ($foo ? $foo : 'not true');

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /