【发布时间】:2016-01-07 02:36:37
【问题描述】:
我已经使用 php 代码跟踪了 html 标记:
<div class="block">
<div class="block-title">
<?php if ($user->isOnline()): ?>
<a href="<?=Url::create('/user/logout');?>">Logout</a>
<?php endif; ?>
</div>
</div>
当我运行代码嗅探器时,我收到以下错误:
<error line="3" column="15" severity="error" message="Line indented incorrectly; expected 8 spaces, found 0" source="Generic.WhiteSpace.ScopeIndent.Incorrect"/>
<error line="5" column="15" severity="error" message="Closing brace must be on a line by itself" source="PEAR.WhiteSpace.ScopeClosingBrace.Line"/>
我试图在 html 视图中找到有关 php 构造的任何标准或描述,但没有任何相关内容。
也许,有人知道 html 中的 if 和 foreach 指令的外观吗?
谢谢。
【问题讨论】:
-
尝试删除
<a href...行的一个缩进。 -
@VincentDecaux,不,它不起作用。
-
如果您不在 2.3.4 上,您可能想尝试升级到最新的 PHPCS 版本,因为已经为此类视图代码添加了修复程序,假设您使用的是内置标准像 PSR2 或 PEAR。
-
@GregSherwood,谢谢,但不幸的是,我无法将当前版本的代码嗅探器升级到最新版本。
标签: php codesniffer phpcodesniffer