Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Improper body indentation for split inline tags

Aberta
#1,668 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
php
Domínio
tooling

Direção de pesquisa

Comece reproduzindo a entrada PHP fornecida com a configuração listada do Prettier e do plugin PHP; em seguida, acompanhe como as tags inline divididas e as expressões incorporadas nelas são formatadas. Está concluído quando as expressões divididas usam uma indentação consistente e o comportamento escolhido é coberto por um caso de regressão para este exemplo.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Prettier 2.2.1

PHP Plugin 0.16.1

{
	"printWidth": 100,
	"useTabs": true,
	"semi": true,
	"quoteProps": "consistent",
	"trailingComma": "all",
	"phpVersion": "7.4",
	"braceStyle": "1tbs"
}

Input:

<div>
	<p> some html </p>
	<div>
		<p>some more html with an inline element <?= htmlspecialchars("test") ?> and another inline element <?= htmlspecialchars("test") ?> with even more <?= htmlspecialchars("test") ?></p>
	</div>
</div>

Output:

<div>
	<p> some html </p>
	<div>
		<p>some more html with an inline element <?= htmlspecialchars(
  	"test",
  ) ?> and another inline element <?= htmlspecialchars(
 	"test",
 ) ?> with even more <?= htmlspecialchars("test") ?></p>
	</div>
</div>

Expected behavior:

This is an issue of opinion so there are multiple solutions here, however, I think everyone would agree that all the parts should be indented the same (or at least identically).

image

The two htmlspecialchars that got split have different amounts of indentation on their closing parenthesis. Additionally, I would argue that the entire block should be indented the same, even if it produced something weird like:

		<p>some more html with an inline element <?= htmlspecialchars(
		  	"test",
		) ?> and another inline element <?= htmlspecialchars(
		 	"test",
		) ?> with even more <?= htmlspecialchars("test") ?></p>

(which is weird HTML with the <p> being on the same line of a multi-line body, however, this is a PHP prettier plugin, not HTML).

Linguagem predominante
PHP
Estrelas
1.9k
Forks
139
Métricas de merge de PRs
Nenhum PR com merge em 30d

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de prettier/plugin-php

Todas as issues de prettier/plugin-php

Issues semelhantes

Mais issues de PHP

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.