Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22402136
ArcanistUnaryPrefixExpressionSpacingXHPASTLinterRule.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
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
Fri, Nov 27, 18:29 (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1209269
Default Alt Text
ArcanistUnaryPrefixExpressionSpacingXHPASTLinterRule.php (1 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline