不清楚的代码嗅探器错误
Unclear Code Sniffer Errors
我已使用 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
指令应该怎么看?
谢谢。
我解决了我的问题,但代码看起来不太好:
<div class="block">
<div class="block-title">
<?php
if ($user->isOnline()): ?>
<a href="<?=Url::create('/user/logout');?>">Logout</a>
<?php
endif; ?>
</div>
所以我决定用 @codingStandardsIgnoreFile
注释将视图文件添加到 Code Sniffer 忽略列表中。现在,需要手动检查代码风格,但代码看起来好多了。
我已使用 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
指令应该怎么看?
谢谢。
我解决了我的问题,但代码看起来不太好:
<div class="block">
<div class="block-title">
<?php
if ($user->isOnline()): ?>
<a href="<?=Url::create('/user/logout');?>">Logout</a>
<?php
endif; ?>
</div>
所以我决定用 @codingStandardsIgnoreFile
注释将视图文件添加到 Code Sniffer 忽略列表中。现在,需要手动检查代码风格,但代码看起来好多了。