Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2890209
ArcanistUnaryPostfixExpressionSpacingXHPASTLinterRule.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
1014 B
Referenced Files
None
Subscribers
None
ArcanistUnaryPostfixExpressionSpacingXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistUnaryPostfixExpressionSpacingXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
75
;
public
function
getLintName
(
)
{
return
pht
(
'Space Before Unary Postfix Operator'
)
;
}
public
function
getLintSeverity
(
)
{
return
ArcanistLintSeverity
::
SEVERITY_WARNING
;
}
public
function
process
(
XHPASTNode
$root
)
{
$expressions
=
$root
->
selectDescendantsOfType
(
'n_UNARY_POSTFIX_EXPRESSION'
)
;
foreach
(
$expressions
as
$expression
)
{
$operator
=
$expression
->
getChildOfType
(
1
,
'n_OPERATOR'
)
;
$operator_value
=
$operator
->
getConcreteString
(
)
;
list
(
$before
,
$after
)
=
$operator
->
getSurroundingNonsemanticTokens
(
)
;
if
(
!
empty
(
$before
)
)
{
$leading_text
=
implode
(
''
,
mpull
(
$before
,
'getValue'
)
)
;
$this
->
raiseLintAtOffset
(
$operator
->
getOffset
(
)
-
strlen
(
$leading_text
)
,
pht
(
'Unary postfix operators should not be prefixed by whitespace.'
)
,
$leading_text
,
''
)
;
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 13:12 (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1120820
Default Alt Text
ArcanistUnaryPostfixExpressionSpacingXHPASTLinterRule.php (1014 B)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment