forked from PHPCSStandards/PHPCSExtra
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WhiteSpace/PrecisionAlignment: bug fix - improved handling of heredoc…
…/nowdoc closers This commit fixes two bugs: 1. When a heredoc/nowdoc closer (PHP 7.3+ flexible syntax) is indented with tabs, PHPCS does not replace tabs with spaces in the token. This means the token `'length'` key will also be tab-based, which leads to incorrrect calculations and false positives with incorrect fixes. Fixed now by handling tab replacement in heredoc/nowdoc closer tokens in the sniff itself. 2. A heredoc/nowdoc closer using flexible syntax is not allowed to have a larger indent than any of the content of the heredoc/nowdoc. Doing so results in a parse error. With the "best guess" rounding of the indent, the sniff had a risk of introducing these kind of parse errors. Fixed now by always rounding the expected indent down to the nearest tabstop for these tokens. Includes additional unit tests to cover the changes.
- Loading branch information
Showing
4 changed files
with
183 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters