Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3281677
ArcanistNewlineAfterOpenTagXHPASTLinterRule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
ArcanistNewlineAfterOpenTagXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistNewlineAfterOpenTagXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
81
;
public
function
getLintName
(
)
{
return
pht
(
'Newline After PHP Open Tag'
)
;
}
public
function
getLintSeverity
(
)
{
return
ArcanistLintSeverity
::
SEVERITY_ADVICE
;
}
public
function
process
(
XHPASTNode
$root
)
{
$tokens
=
$root
->
selectTokensOfType
(
'T_OPEN_TAG'
)
;
foreach
(
$tokens
as
$token
)
{
for
(
$next
=
$token
->
getNextToken
(
)
;
$next
;
$next
=
$next
->
getNextToken
(
)
)
{
if
(
$next
->
getTypeName
(
)
==
'T_WHITESPACE'
&&
preg_match
(
'/\n\s*\n/'
,
$next
->
getValue
(
)
)
)
{
continue
2
;
}
if
(
$token
->
getLineNumber
(
)
!=
$next
->
getLineNumber
(
)
)
{
break
;
}
if
(
$next
->
getTypeName
(
)
==
'T_CLOSE_TAG'
)
{
continue
2
;
}
}
$next
=
$token
->
getNextToken
(
)
;
$this
->
raiseLintAtToken
(
$next
,
pht
(
'`%s` should be separated from code by an empty line.'
,
'<?php'
)
,
"\n"
.
$next
->
getValue
(
)
)
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Mar 24, 00:36 (13 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1120966
Default Alt Text
ArcanistNewlineAfterOpenTagXHPASTLinterRule.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment