Describe the bug
When using findStartOfStatement() in conjunction with T_OPEN_TAG_WITH_ECHO, it skips ahead to code before it.
Code sample
$start_of_statement = $this->phpcsFile->findStartOfStatement( $stackPtr, T_COMMA );
To reproduce
Using the below sample with $stackPtr being esc_attr, I would expect $start_of_statement to return T_OPEN_TAG_WITH_ECHO:
<h1>Test</h1>
<?= '<h2>' , esc_attr( $test ) , '</h2>';
However, it returns T_INLINE_HTML from <h1>Test</h1>.
Expected behavior
I expect it to act similar to the below, where $start_of_statement returns T_ECHO:
<h1>Test</h1>
<?php echo '<h2>' , esc_attr( $test ) , '</h2>';
Versions:
- OS: [e.g., Windows 10, MacOS 10.15]
- PHP: 7.4.15
- PHPCS: master
- Standard: N/A
Additional context
Ran into it during Automattic/VIP-Coding-Standards#671.