Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
79 views
in Technique[技术] by (71.8m points)

php - Do Not Indent to Opening Tag When in Inline HTML

When using PHPCS with the Generic.WhiteSpace.ScopeIndent sniff, it tries to indent code to the level of the opening tag.

Take this example for instance (from a Wordpress plugin):

<p class="description"><?php esc_html_e(
    'Stuff here',
    'plugin'
) ?></p>

It wants me to align the closing line with the beginning of the open tag, which in this case would amount to a 23-character indent.

I don't want that: I'd rather style it like above. But I can't figure out how to disable this without disabling the entire sniff.

I could of course move the opening tag to the next line but I'd like to find a way around this without always needing to do that, as I prefer not to have superfluous spacing in the HTML.

question from:https://stackoverflow.com/questions/65931803/do-not-indent-to-opening-tag-when-in-inline-html

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...