Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22415690
ArcanistUnaryPostfixExpressionSpacingXHPASTLinterRule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
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
Sat, Nov 28, 01:28 (1 d, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1208813
Default Alt Text
ArcanistUnaryPostfixExpressionSpacingXHPASTLinterRule.php (1014 B)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline