Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3281799
ArcanistLanguageConstructParenthesesXHPASTLinterRule.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
ArcanistLanguageConstructParenthesesXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistLanguageConstructParenthesesXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
46
;
public
function
getLintName
(
)
{
return
pht
(
'Language Construct Parentheses'
)
;
}
public
function
getLintSeverity
(
)
{
return
ArcanistLintSeverity
::
SEVERITY_WARNING
;
}
public
function
process
(
XHPASTNode
$root
)
{
$nodes
=
$root
->
selectDescendantsOfTypes
(
array
(
'n_INCLUDE_FILE'
,
'n_ECHO_LIST'
,
)
)
;
foreach
(
$nodes
as
$node
)
{
$child
=
head
(
$node
->
getChildren
(
)
)
;
if
(
$child
->
getTypeName
(
)
===
'n_PARENTHETICAL_EXPRESSION'
)
{
list
(
$before
,
$after
)
=
$child
->
getSurroundingNonsemanticTokens
(
)
;
$replace
=
preg_replace
(
'/^\((.*)\)$/'
,
'$1'
,
$child
->
getConcreteString
(
)
)
;
if
(
!
$before
)
{
$replace
=
' '
.
$replace
;
}
$this
->
raiseLintAtNode
(
$child
,
pht
(
'Language constructs do not require parentheses.'
)
,
$replace
)
;
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Mar 24, 01:45 (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1121989
Default Alt Text
ArcanistLanguageConstructParenthesesXHPASTLinterRule.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment