Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3282703
ArcanistUnaryPrefixExpressionSpacingXHPASTLinterRule.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
ArcanistUnaryPrefixExpressionSpacingXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistUnaryPrefixExpressionSpacingXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
73
;
public
function
getLintName
(
)
{
return
pht
(
'Space After Unary Prefix Operator'
)
;
}
public
function
getLintSeverity
(
)
{
return
ArcanistLintSeverity
::
SEVERITY_WARNING
;
}
public
function
process
(
XHPASTNode
$root
)
{
$expressions
=
$root
->
selectDescendantsOfType
(
'n_UNARY_PREFIX_EXPRESSION'
)
;
foreach
(
$expressions
as
$expression
)
{
$operator
=
$expression
->
getChildOfType
(
0
,
'n_OPERATOR'
)
;
$operator_value
=
$operator
->
getConcreteString
(
)
;
list
(
$before
,
$after
)
=
$operator
->
getSurroundingNonsemanticTokens
(
)
;
switch
(
strtolower
(
$operator_value
)
)
{
case
'clone'
:
case
'echo'
:
case
'print'
:
break
;
default
:
if
(
!
empty
(
$after
)
)
{
$this
->
raiseLintAtOffset
(
$operator
->
getOffset
(
)
+
strlen
(
$operator
->
getConcreteString
(
)
)
,
pht
(
'Unary prefix operators should not be followed by whitespace.'
)
,
implode
(
''
,
mpull
(
$after
,
'getValue'
)
)
,
''
)
;
}
break
;
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Mar 24, 10:08 (4 w, 15 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1123800
Default Alt Text
ArcanistUnaryPrefixExpressionSpacingXHPASTLinterRule.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment