Skip to content

Commit 5fe56f4

Browse files
committed
patched StatementIndentationFixer, allows multiple constants:
Preserves this format: echo "<h1 style='all:initial; display:block; font-size:2em; margin:1em 0'>", htmlspecialchars($string), "</h1>\n";
1 parent 0f7230b commit 5fe56f4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

preset-fixer/common/Nette.php

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
'Nette/curly_braces_position' => true,
3636

3737
// Each statement must be indented
38+
'statement_indentation' => false,
3839
'Nette/statement_indentation' => true,
3940

4041
// In the argument list, there must be one space after each comma, and there must no be a space before each comma

src/Fixer/StatementIndentationFixer.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
* with this source code in the file LICENSE.
1313
*/
1414

15-
namespace PhpCsFixer\Fixer\Whitespace;
15+
// PhpCsFixer\Fixer\Whitespace
16+
namespace NetteCodingStandard\Fixer\Whitespace;
1617

1718
use PhpCsFixer\AbstractFixer;
1819
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
@@ -555,7 +556,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
555556
--$currentScope;
556557
}
557558

558-
if ($token->isComment() || $token->equalsAny([';', ',', '}', [T_OPEN_TAG], [T_CLOSE_TAG], [CT::T_ATTRIBUTE_CLOSE]])) {
559+
if ($token->equalsAny([';', '}', [T_OPEN_TAG], [T_CLOSE_TAG], [CT::T_ATTRIBUTE_CLOSE]])) {
559560
continue;
560561
}
561562

@@ -831,4 +832,9 @@ private function getSiblingContinuousSingleLineComment(Tokens $tokens, int $inde
831832

832833
return $siblingIndex;
833834
}
835+
836+
public function getName(): string
837+
{
838+
return 'Nette/' . parent::getName();
839+
}
834840
}

0 commit comments

Comments
 (0)