Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3281615
ArcanistArrayIndexSpacingXHPASTLinterRule.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
920 B
Referenced Files
None
Subscribers
None
ArcanistArrayIndexSpacingXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistArrayIndexSpacingXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
28
;
public
function
getLintName
(
)
{
return
pht
(
'Spacing Before Array Index'
)
;
}
public
function
getLintSeverity
(
)
{
return
ArcanistLintSeverity
::
SEVERITY_WARNING
;
}
public
function
process
(
XHPASTNode
$root
)
{
$indexes
=
$root
->
selectDescendantsOfType
(
'n_INDEX_ACCESS'
)
;
foreach
(
$indexes
as
$index
)
{
$tokens
=
$index
->
getChildByIndex
(
0
)
->
getTokens
(
)
;
$last
=
array_pop
(
$tokens
)
;
$trailing
=
$last
->
getNonsemanticTokensAfter
(
)
;
$trailing_text
=
implode
(
''
,
mpull
(
$trailing
,
'getValue'
)
)
;
if
(
preg_match
(
'/^ +$/'
,
$trailing_text
)
)
{
$this
->
raiseLintAtOffset
(
$last
->
getOffset
(
)
+
strlen
(
$last
->
getValue
(
)
)
,
pht
(
'Convention: no spaces before index access.'
)
,
$trailing_text
,
''
)
;
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Mar 23, 23:58 (1 d, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1120447
Default Alt Text
ArcanistArrayIndexSpacingXHPASTLinterRule.php (920 B)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment