mirror of
https://github.com/elyby/php-code-style.git
synced 2024-12-22 13:09:50 +05:30
Fixes #9. Add space before next meaningful line of code and skip comments
This commit is contained in:
parent
22dcb418fb
commit
6e9d815a1f
@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Fixed
|
### Fixed
|
||||||
- Bug #10: `Ely/blank_line_before_return` don't treat interpolation curly bracket as beginning of the scope.
|
- Bug #10: `Ely/blank_line_before_return` don't treat interpolation curly bracket as beginning of the scope.
|
||||||
|
- Bug #9: `Ely/line_break_after_statements` add space before next meaningful line of code and skip comments.
|
||||||
|
|
||||||
## [0.4.0] - 2022-12-06
|
## [0.4.0] - 2022-12-06
|
||||||
### Added
|
### Added
|
||||||
|
@ -26,7 +26,7 @@ final class LineBreakAfterStatementsFixer extends AbstractFixer implements White
|
|||||||
/**
|
/**
|
||||||
* There is no 'do', 'cause the processing of the 'while' also includes do {} while (); construction
|
* There is no 'do', 'cause the processing of the 'while' also includes do {} while (); construction
|
||||||
*/
|
*/
|
||||||
public const STATEMENTS = [
|
private const STATEMENTS = [
|
||||||
T_IF,
|
T_IF,
|
||||||
T_SWITCH,
|
T_SWITCH,
|
||||||
T_FOR,
|
T_FOR,
|
||||||
@ -93,7 +93,7 @@ class Foo
|
|||||||
}
|
}
|
||||||
|
|
||||||
$endStatementIndex = $this->findStatementEnd($tokens, $index);
|
$endStatementIndex = $this->findStatementEnd($tokens, $index);
|
||||||
$nextStatementIndex = $tokens->getNextNonWhitespace($endStatementIndex);
|
$nextStatementIndex = $tokens->getNextMeaningfulToken($endStatementIndex);
|
||||||
if ($nextStatementIndex === null) {
|
if ($nextStatementIndex === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -575,6 +575,14 @@ class Foo
|
|||||||
}
|
}
|
||||||
}',
|
}',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
yield [
|
||||||
|
'<?php
|
||||||
|
do {
|
||||||
|
$a = 123;
|
||||||
|
} while ($value > 10); // comment here
|
||||||
|
',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createFixer(): AbstractFixer {
|
protected function createFixer(): AbstractFixer {
|
||||||
|
Loading…
Reference in New Issue
Block a user