PHPCSStandards / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
906 stars 55 forks source link

Add Fixer method to remove a line #517

Closed andrewnicols closed 3 weeks ago

andrewnicols commented 4 months ago

Is your feature request related to a problem?

When writing some sniff fixes, it's necessary to remove an entire line. Currently there is no helper for this. This is particularly helpful when writing sniffs for phpdocs.

Describe the solution you'd like

$phpcsFile->fixer->beginChangeset();
$phpcsFile->fixer->removeLineAtPointer($stackPtr);
$phpcsFile->fixer->endChangeset();

Additional context (optional)

jrfnl commented 4 months ago

@andrewnicols I'd like to see a more thorough specification of what you'd expect such a method to do, as it feels like the current description is wide open to interpretation.

Here are just some of the questions which pop up in my mind and there's bound to be more:

jrfnl commented 3 weeks ago

Closing for lack of reply. As things are, this issue is not actionable. The issue can be reopened for further discussion if the requested additional information is added.